mysql fulltext search natural language mode vs boolean mode accuracy
Asked Answered
C

2

6

I have items table of online store, which has fulltext index on item_title, item_description, item_category columns. I would like to write search script, but having problem with deciding in which mode to search (natural language or boolean mode). Let's say user searches for intel core i5 notebooks. If I set natural language mode in search script user will not be able to search for query intel core i5 notebooks -apple. Can anybody explain me the difference between natural language mode and boolean mode? Which is more accurate?

Chaunce answered 11/3, 2013 at 19:4 Comment(5)
What do you need to know in addition to the information provided here?Lucia
@RobertHarvey the difference in scoring for exampleChaunce
The information on that page seems to suggest that there isn't any change in scoring. Your decision on which to use should be based on whether or not you need the Boolean mode features.Lucia
sphinxsearch is what you are looking for.Hillari
@Hillari I am on shared hosting ;)Chaunce
I
5

Natural Language Full-Text Search vs Boolean Full-Text Search

Natural Language Full-Text Search: It considers all the text in the search keywords as it is naturally with no characters holding special meaning.

For instance, intel core i5 notebooks -apple IN NATURAL LANGUAGE MODE would return all matches that contain intel, core, i5, notebooks, and -apple.

Boolean Full-Text Search: Some characters have a special meaning. Examples are: +, -, *. In your case, intel core i5 notebooks -apple IN BOOLEAN MODE would return all matches that contain intel, core, i5, and notebooks. In the matches to be found apple must not be included. The - sign has a special meaning and it will not be considered as regular/natural text.

Back to your question: Which is more accurate?

It depends on the results you want to get. If you want apple to be present in your results then you may use 'IN NATURAL LANGUAGE MODE'.

If you do not want apple in your results, then use 'IN BOOLEAN MODE'.

Irregularity answered 27/6, 2022 at 16:50 Comment(0)
U
1

Basically the difference is between this and this

And in your case, I can say you need boolean mode

'+"intel core i5 notebooks" -apple'

Unlay answered 7/5, 2019 at 7:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.