[SERVER-20792] Hyphen in text search doesn't behave correctly based on usual implementation Created: 07/Oct/15  Updated: 28/Sep/16  Resolved: 05/Feb/16

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

Type: Bug Priority: Minor - P4
Reporter: Josef Sábl Assignee: Charlie Swanson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server20792_fts_negation.js    
Issue Links:
Documented
is documented by DOCS-8958 Hyphen in text search doesn't behave ... Closed
Duplicate
is duplicated by SERVER-21347 The negated term hypen is to liberal ... Closed
Backwards Compatibility: Major Change
Operating System: ALL
Sprint: Query 10 (02/22/16)
Participants:

 Description   

It is common, that hyphen negates the following word in text search.

But it is standard that the hyphen must be directly adjacent to the word. E.g "MongoDB -documentation". See Google.

Contrary, MongoDB's implementation negates the word even if the hyphen is NOT adjacent "MongoDB - documentation". See Google again.

This is very poor in common user scenarios. People use copy paste frequently, when searching for text and text frequently contains hyphens to separate words.

"MongoDB - Wikipedia, the free encyclopedia" would not find this article on wikipedia, should Google use MongoDB.



 Comments   
Comment by Charlie Swanson [ 05/Feb/16 ]

This changes how text queries are parsed in a way that was backwards breaking. See the commit message for an example.

Comment by Githook User [ 05/Feb/16 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-20792 Only negate term if directly proceeded by hyphen.

For example, the term "documentation" should be negated in the text
query "MongoDB -documentation", but should not be negated in the text
query "MongoDB - documentation".
Branch: master
https://github.com/mongodb/mongo/commit/1ddd9162e8fd7de3b54053093698ef16abce8aa9

Comment by Wan Bachtiar [ 21/Oct/15 ]

Hi Josef,

Thanks for the feedback.

To confirm the current behaviour I have attached a test JS file. I have marked this issue to be considered for planning in a future iteration / development cycle.

Regards,
Wan

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