[WIP] Allowed search results for Django code terms which contain stop words.#1942
[WIP] Allowed search results for Django code terms which contain stop words.#1942sarahboyce wants to merge 1 commit intodjango:mainfrom
Conversation
98d99a0 to
5eaaba6
Compare
5eaaba6 to
cdc5c23
Compare
|
@sarahboyce I'm sorry, but I don't have time to review many proposals these days. However, I have already tried to explain in the issues you linked the problem related to the search terms that are also stop words. I'll try to add a some considerations that may help. PostgreSQL full-text search is heavily based on the dictionaries of the language in which the search is performed, so switching to the “simple” dictionary makes you lose many of the features, not only the removal of stop words. See the PostgreSQL documentation.
https://www.postgresql.org/docs/current/textsearch-intro.html BTW, the issue you're trying to solve in this PR only apply for searches in English, where a term in English is the same as the one used in the code. But English is only one of the various supported by the documentation, and using the “simple” dictionary could improve things for English but worsen them for other languages. In fact, if you search for the word “through” in French you will get correct results, and we want to maintain this behavior for all languages other than English. I'm not sure using the “simple” dictionary for all languages is the best solution. Another solution I can think of to solve the problem with the English language and leave things unchanged for the other languages of the documentation is to create a custom dictionary for English. This involves removing from the stop words those that match names used in the code. See https://www.postgresql.org/docs/current/textsearch-dictionaries.html Here I had reported an example of creating a custom dictionary for French as an example, the procedure should be similar. |
cdc5c23 to
beb0f50
Compare
| @@ -0,0 +1,38 @@ | |||
| # Instructions to create a new search dictionary | |||
There was a problem hiding this comment.
I have never done this before so these instructions may not be very good
I would love it if we can create this custom search dictionary in our docker setup as well
There was a problem hiding this comment.
Great job. Still few time to review properly, but I had two ideas:
- create a migration to create a custom English dictionary
- write the list of words you removed from the original list of stop words and a command/pathc/other to remove those words from the final stop words list you uploaded
bebc9a2 to
8e273f1
Compare
8e273f1 to
eb35e12
Compare
Refs #1097