etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.21k stars 129 forks source link

How to access ACTUAL MySQL search score from result object? #207

Closed ursomniac closed 7 years ago

ursomniac commented 7 years ago

I thought that 'watson_rank' would copy over the score that you get from the fulltext search, however it appears to be something completely different. I can't see anything in the result object that points to the actual MySQL score for that object. Am I missing something?

Update (sort of answering my own question):

Well, I was first missing that the search is done in BOOLEAN mode, not NATURAL LANGUAGE mode (it would be nice to be able to select which mode to use), but I still don't understand the hard-coded weighting function (3, 2, *1) for (title, description, content) ... Ideally that should be changeable either in settings, or as an option to the search() call. Extra-ideally, it would be FANTASTIC if you could also weight on content_type_id as well.

etianen commented 7 years ago

watson_rank is indeed the score from the fulltext search. Because three columns are searched, the result is weighted so:

On 26 June 2017 at 13:24, Bob Donahue notifications@github.com wrote:

I thought that 'watson_rank' would copy over the score that you get from the fulltext search, however it appears to be something completely different. I can't see anything in the result object that points to the actual MySQL score for that object. Am I missing something?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/207, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCBY00EQnNaPrx3IRK0NF1QRrfdilks5sH6MGgaJpZM4OFPOq .