[DOCS-10382] Clarify if MongoDB text search is correct in manual or not Created: 11/Jun/17  Updated: 30/Oct/23  Resolved: 22/Jan/19

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: 아나 하리 Assignee: Stennie Steneker (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

https://docs.mongodb.com/manual/text-search/


Issue Links:
Duplicate
is duplicated by DOCS-10396 Comment on: "manual/text-search" Closed
is duplicated by DOCS-11632 Text Search not working properly Closed
Related
related to SERVER-30163 Additional terms in phrase search are... Backlog
Participants:
Days since reply: 5 years, 3 weeks, 2 days ago
Epic Link: DOCSP-1769
Story Points: 0.2

 Description   

According to the manual (https://docs.mongodb.com/manual/text-search/),
Below text search will find all documents containing “java” or “coffee shop”,
But in the result all documents containing only "java" are excluded. This text search return documents containing only "coffee shop".

db.stores.find( { $text: { $search: "java \"coffee shop\"" } } )

I am not sure whether manual is correct or not. Anyway manual and MongoDB result are not matched.



 Comments   
Comment by Githook User [ 22/Jan/19 ]

Author:

{'email': 'stennie@cpan.org', 'name': 'Stephen Steneker', 'username': 'stennie'}

Message: DOCS-10382: Clarify text search phrase matching behaviour
Branch: v3.2
https://github.com/mongodb/docs/commit/aecde5c6636f559b11b9c8d129dfa087caa6b7ca

Comment by Githook User [ 22/Jan/19 ]

Author:

{'username': 'stennie', 'email': 'stennie@cpan.org', 'name': 'Stephen Steneker'}

Message: DOCS-10382: Clarify text search phrase matching behaviour
Branch: v3.4
https://github.com/mongodb/docs/commit/73cf6de7f5553342f56e859ceaef117c199c2516

Comment by Githook User [ 22/Jan/19 ]

Author:

{'email': 'stennie@cpan.org', 'name': 'Stephen Steneker', 'username': 'stennie'}

Message: DOCS-10382: Clarify text search phrase matching behaviour
Branch: v3.6
https://github.com/mongodb/docs/commit/71ed40fff6dbb5498dc165cb6ffb8b25c907c3b4

Comment by Githook User [ 22/Jan/19 ]

Author:

{'email': 'stennie@cpan.org', 'name': 'Stephen Steneker', 'username': 'stennie'}

Message: DOCS-10382: Clarify text search phrase matching behaviour
Branch: v4.0
https://github.com/mongodb/docs/commit/4d47ff3c85a392469eba4fc19c95afa759a45f6b

Comment by Githook User [ 22/Jan/19 ]

Author:

{'username': 'stennie', 'email': 'stennie@cpan.org', 'name': 'Stephen Steneker'}

Message: DOCS-10382: Clarify text search phrase matching behaviour
Branch: master
https://github.com/mongodb/docs/commit/db570540c90210e19b8f7402937e4af4439d9414

Comment by Mark Agarunov [ 12/Jun/17 ]

david.storch, According to other parts of the documentation, which Thomas linked, as well as previous tickets requesting a way to perform an exact phrase search with OR instead of AND (https://jira.mongodb.org/browse/SERVER-22583), I concluded that the behavior is intentional, therefore documentation is incorrect. Additionally, my assumption would be that the phrase must be present in the document to be returned when searching for an exact phrase.

Comment by David Storch [ 12/Jun/17 ]

mark.agarunov, how did you conclude that this behavior is a documentation bug and not a server bug? When I saw this report I was concerned that the original reporter had found a server bug. I'll try to spend a few minutes digging into the code later in order to try and decide whether this was intentional or not.

EDIT: Oh, I think I see now. This phrase search query means "coffee shop" AND ("java" OR "coffee" OR "shop"). Given this meaning, it appears that the text search engine is functioning as designed. I was surprised to learn that this query does not mean "coffee shop" AND "java".

Comment by Kelsey Schubert [ 12/Jun/17 ]

For reference, underlying logic is correctly documented here: https://docs.mongodb.com/manual/reference/operator/query/text/#phrases

Comment by Mark Agarunov [ 12/Jun/17 ]

Hello matt.lee,

Thank you for the report. I've been able to reproduce the behavior you've described and agree that it does not match the behavior as documented:

Exact Phrase

You can also search for exact phrases by wrapping them in double-quotes. For example, the following will find all documents containing “java” or “coffee shop”:

I've moved this ticket to the DOCS project so that the documentation can be updated to reflect the actual behavior.

Thanks,
Mark

Generated at Thu Feb 08 08:00:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.