I added a commit with the proper change: Add search not operator by kasiabulat · Pull Request #5467 · discourse/discourse · GitHub
But it seems that after this change the code isn’t passing The Travis CI build (although it was passing it previously and I only changed the “~” symbol into “!” in few places)… Have I overlooked something? Had this job changed in the meantime maybe? Is “!” for sure a good symbol to use? Can pulling the repository change something as I haven’t updated it since the previous commit?
Thanks! Your changes look good to me.
We are having problems with Travis builds. The build failure is unrelated to your changes.
What do you suggest I could work on now? Some time ago I added comments on the performance of my change on github. I wondered whether I should try to replace “NOT IN” with “NOT EXIST” (it would be faster then, but I found it not easy to do with active records), choose a completely different way of implementing the feature or leave it as it is. There’s also the new issue connected with search: Include translated posts in search?, so maybe I could take a look at it in the meantime?
@kasiabulat Apologies for the lack of response from us as we’re trying to figure out internally what the search operator should look like. Do you think it’ll be hard to support sometime like
Do you know if there’s an easy way to swap the ispell / stemmer dictionaries used?
Even if so, would it not require more tables?
@tgxworld Do you mean splitting on
-tags: instead of
-? So for more complex example:
tags:eggs+beacon -tags:lunch,sandwiches it would search for posts with
beacon tags, but without
lunch and without
sandwiches tags? Then, I think it would be a quick change.
Yup we’ll like to support that syntax
OK, I’ll work on that.
The needed change was a bit different than I expected as searched phrase is split on white characters at the beginning and then each part is processed with all matching advanced search functions. I divided searching tags into two short functions, but I think now it’s even more clear.
@Mittineague I’m afraid I am not so deep in the topic to understand what you are exactly asking about. Could you give me some more details?
Postgres uses “dictionaries”:
PostgreSQL: Documentation: 9.1: Dictionaries
Ispell dictionaries try to reduce input words to a normalized form; stemmer dictionaries remove word endings
Postgres searches involve stop words (considered as insignicant / unhelpful) and lexemes (the “root” word).
For extreme examples if in one locale the text was
πάντες γὰρ οἱ λαβόντες μάχαιραν ἐν μαχαίρῃ ἀπολοῦνται
Or in another
Converte gladium tuum in locum suum. Omnes enim, qui acceperint gladium, gladio peribunt.
Search wouldn’t work so well looking for “sword”.
In other words, for searching to work with translations. I think the more things match up the better.
Hi, has this been implemented? If so which syntax was chosen
Yes, I have the same question. Has this “not” search implemented?
Pull request is shown as open and tagged for 2.1
This is merged in