Jump to content

FULLTEXT sorting


mentalist

Recommended Posts

Hi,

Im having trouble doing a sort using boolean fulltext. Ive read that the boolean version doesnt sort, but some comments say you can. Ive done other versions but boolean is only one which returns all results, just not ordered.

 

$s = "SELECT *, MATCH(title,info) AGAINST ('".$searchy."') AS score FROM test_search WHERE MATCH(title,info) AGAINST ('".$searchy."' IN BOOLEAN MODE) ORDER BY score DESC";

 

Is this the way to go, say maybe running a sort after, or is there a better way to do a search with relevance sorting?

Link to comment
https://forums.phpfreaks.com/topic/152887-fulltext-sorting/
Share on other sites

ok,

 

$s = "SELECT *, MATCH(title,info) AGAINST ('fish') AS score FROM test_search WHERE MATCH(title,info) AGAINST ('fish' IN BOOLEAN MODE) ORDER BY score DESC";

 

The sample data was the first four pages from a google search using the term 'fish'. I messed up the order but all had different match counts of the word 'fish' but between 11 and 16 times.

 

The boolean results returned all in no particular order other than there chronological entry in the db.

The natural language variation only returned two of the examples, also the one with fewer matches was also scored higher.

 

At first I was I was in agreement with your 'huh' comment, as in it doesn't make much sense. It looks good good, but in reality neither use nor ornament, without using external packages. But then i'm not sure if that's what your inferring!

 

Link to comment
https://forums.phpfreaks.com/topic/152887-fulltext-sorting/#findComment-803967
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.