Quick Search Order by Score

Discussion corner for Developers of Serendipity.
Post Reply
DIARY.JOMYUT.NET

Quick Search Order by Score

Post by DIARY.JOMYUT.NET »

My Serendipity version is 0.8.2 at http://diary.jomyut.net

I think if search and ranking it by score , it be better than ranking by timestamp like now. [ My English so bad]
See here ....
file : function_entries.inc.php
function : function serendipity_searchEntries

line 446 : $find_part = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)";
ex. if I type "hello*" in quicksearch it will return entries that have word "hello" , "helloworld" , "helloaaa"
I mean user can specific advance option to search (by use + - * ( ) " ~ )

line 479 : e.exflag,
line 480 : $find_part AS score
line 483 : ORDER BY score DESC

this will ranking word by score.

if you not understand me,you can see http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html


It is very bad when I search word in Thai.Cause Thai language will write by not space (like Iamaboy NOT I am a boy)
You can try by type
องศา
on Quicksearch in http://diary.jomyut.net , I will not found. try again with
*องศา*
You will found many document. but some document not contain "องศา" but it have only "อง".

I want to tell that Can you use PHP to search again? to find that it have องศา not อง in document.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Quick Search Order by Score

Post by garvinhicking »

Hi!

Thanks for your suggestion about the ordernig! I will commit a patch for this to make the admin decide how he wants his results ordered...

The other problem - is there a way to solve your search in MySQL? Because using PHP would be very inefficient...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Post by wesley »

While we're on the topic of quick search... I've encountered an obvious, uh... hole in the method involved. It's not really the fault of the quick search, per se, but nevertheless somewhat icky.

Multilingual entries don't get searched.

I think it's because they are stored in a different table altogether. Perhaps there needs to be a way to search this 'other' table, too. All my Korean visitors would tell me the search feature is broken...
I make s9y plugins, too.
My s9y blog depends on them. :)
Guest

Re: Quick Search Order by Score

Post by Guest »

garvinhicking wrote:Hi!
The other problem - is there a way to solve your search in MySQL? Because using PHP would be very inefficient...
Thanks for your answer,
I haven't found solition to search my language in MySQL.
I know that using PHP to search is very inefficient but I dont have a way be better than this cause MySQL doesn't support my language.

Can s9y have option that search in MySQL and search in PHP again?

I will try to find solution to search again on b2evolution source code , I have use it on past and it's work.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Quick Search Order by Score

Post by garvinhicking »

If you care to get your fingers into code, the one responsible for searching in serendipity can be found here:

include/functions_entries.in.php
function serendipity_searchEntries()

You can/could add plugin hooks there to make another PHP search on the results by changing this:

Code: Select all

    $search = serendipity_db_query($querystring);
into:

Code: Select all

    $search = serendipity_db_query($querystring);
    serendipity_plugin_api::hook_event('frontend_searchentries_result', $search, $term)
Then you can use any plugin to iterate through the results and strip out invalid results...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Warun

Post by Warun »

Thanks for suggestion and answer.
I will do it.

Warun
Post Reply