Page 1 of 1
Quicksearch - how to optimize and improve results
Posted: Wed Aug 19, 2009 12:59 pm
by cmscritic
Is there some kind of logic behind the Quick Search feature that I am able to tweak? I've got it on my site and doing a simple search for something like "drupal" gives me tons of totally irrelevant results with Drupal articles not even showing on the top of the list.
I'm confused as to how it works or how it can be improved before going live.
Re: Quicksearch - how to optimize and improve results
Posted: Wed Aug 19, 2009 1:09 pm
by garvinhicking
Hi!
Serendipity uses the MySQL Fulltextsearch to search for entries, which sorts relevance by number and order of appearance of the word; I believe the weight of a keyword in the title, the body and the extended body is equally distributed.
The search is an internal core feature that can be found in include/functions_entries.inc.php, function serendipity_searchEntries(). Inside that function the SQL query to use can be changed via a plugin API event hook.
HTH,
Garvin
Re: Quicksearch - how to optimize and improve results
Posted: Wed Aug 19, 2009 3:19 pm
by cmscritic
Thanks for the reply. Have you noticed any serious issues with search relevance? For instance, doing a search on my site for the term "drupal" displayed 1 entry that had the word drupal in the paragraph and below it was an actual drupal article that had the term in the title twice and the body more than 6 times and clearly was far more relevant.
Re: Quicksearch - how to optimize and improve results
Posted: Fri Aug 21, 2009 10:11 am
by garvinhicking
Hi!
Sorry, I made an error with my statement. Actually, mysql allows to sort by relevance, but actually the current code orders search results by date, to display blog entries in a chronological order like archives and usual blog pages.
Now that I think about this, this is not useful in cases like yours, where you need relevance most. It's funny that nobody ever asked for that. I've just committed a patch to our core that allows plugins to take over the default sorting. If you'd be willing to upgrade to a s9y snapshot (which will contain that patch as of tomorrows) I could write up a little event plugin for you to use?
Best regards,
Garvin
Re: Quicksearch - how to optimize and improve results
Posted: Fri Aug 21, 2009 4:22 pm
by Don Chambers
Garvin - are you saying that you need to write a plugin that will allow changing the default behavior (date order) of search results?
Re: Quicksearch - how to optimize and improve results
Posted: Fri Aug 21, 2009 10:22 pm
by cmscritic
Hey Garvin,
Thanks for the reply. I'd personally prefer to wait for a stable release. The site is live now and i can't afford to run software that's not stable.
Why not make the changes to the core as opposed to allowing for a plugin to change it? Seems to make more sense that it would use relevance anyway.
Mike
Re: Quicksearch - how to optimize and improve results
Posted: Mon Aug 24, 2009 10:24 am
by garvinhicking
Hi!
Yeah, I could also implement this to the core. It's just that a plugin has more flexibility to deal with options like these.
I've just committed an option for the core to define sort order by date or relevance. It'll be part of the 1.5 final release.
Regards,
Garvin