MySQL Forums
Forum List  »  Newbie

Prioritize phrases in mysql full text search
Posted by: Sandeep Kumar
Date: May 23, 2022 11:20PM

I'm using MySQL full text search for my application, I have a situation where I want to set relevancy according to the priority of the phrases. For example I have 3 phrases "dark blue", "medium blue" and "light blue". Now I want relevant results following this ["dark blue">"medium blue">"light blue"] presidency I.e. records having "dark blue" will show on top after that "medium blue" and in last "light blue". I've tried my times and using different ways but it does not work.

SELECT *, MATCH (searchable) AGAINST ('+(>("dark blue" @2) <("medium blue" @2) <("light blue" @2))' IN BOOLEAN MODE) as score from `collection_data` where MATCH (searchable) AGAINST ('+(>("dark blue" @2) <("medium blue" @2) <("light blue" @2))' IN BOOLEAN MODE)

This gives the matched records but not the in-order I want. searchable is a text column which contains some description of a product.

Options: ReplyQuote


Subject
Written By
Posted
Prioritize phrases in mysql full text search
May 23, 2022 11:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.