#970 - Better support for negated search results
| Identifier | #970 |
|---|---|
| Issue type | Minor issue (breaks specific functionality) |
| Title | Better support for negated search results |
| Status | Completed |
| Handling member | Chris Graham |
| Addon | search |
| Description | Hi,
If you do a search like +brake +pipe -2010 -stand and check the box "Find exact matches (boolean search, may be slow)" Then search still returns results with the words 2010 and stand in the titles, however it respects the search parameters for the contents. If you tick the search titles only box then it behaves as expected. Cheers Ade |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
So it is returning results because one of the fields, in isolation, matches the condition.
We could try and solve it by 3 mechanisms:
1) Create a separate combined text index, separate to main fields
2) Make internationalisation optional
3) Do a set operation to subtract any positive search results for the requested negative criteria
All these would be very labour intensive, so I think it is best just to state that the filter works on each individual field.
However I should note there is still a case that cannot be handled...
If you declare two forced-positive match terms, and they apply, but not all to any single field together, it can't get a match.
E.g. +foo +bar would not match if something had a title of "some foo" and content of "some bar". But it would match if the content was "some foo bar".
This is due to the matching working on individual fields. The overall logic is now combined, with negatives hitting one field disallowing any other fields from matching - but it still operates on individual fields at heart.
This probably is not something many people will ever notice, as it is unlikely a title will be the only place a forced-positive match term will appear.