[SERVER-20483] Search string that only contains negated words should have results Created: 18/Sep/15  Updated: 18/Sep/15  Resolved: 18/Sep/15

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Andrea Venchi Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

Now when I pass a search string that only contains negated words , text search does not match with any documents. But this isn't the correct results of the query. The search should have results if there are any.



 Comments   
Comment by Stennie Steneker (Inactive) [ 18/Sep/15 ]

Hi Andrea,

It is expected that a search string containing only negated words will not return any results for a `$text` index: http://docs.mongodb.org/v3.0/reference/operator/query/text/#negations

Similar to other text search implementations with boolean operators (eg. Lucene, MySQL, ...) negations are used to exclude documents from the result set that would otherwise be matched by terms in the text index. A query that only includes negative terms or stopwords will not return any results as there are no entries in the index to filter.

Regards,
Stephen

Generated at Thu Feb 08 03:54:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.