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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.