RavenDb4 boost search bug

44 views
Skip to first unread message

Alexander Klaus

unread,
Jun 21, 2018, 3:12:52 AM6/21/18
to RavenDB - 2nd generation document database
Given two contact records with surnames "Elliot" and "Elliot-Murray", 

When run the following query 

from index 'Contacts/ForList' 
where Type = 'person'
and (boost(search(LastName, 'Elliot'), 1000) or boost(search(LastName, 'Elliot*'), 800))

Then results are received in a random order: "Elliot-Murray" may appear before "Elliot".

However, when the request above doesn't have additional filtering condition

from index 'Contacts/ForList' 
where boost(search(LastName, 'Elliot'), 1000) or boost(search(LastName, 'Elliot*'), 800)

Then results are received in the expected order: "Elliot" and then "Elliot-Murray".

Is it a bug?

P.S. If it makes any difference, the 'Analyzer' property on 'LastName' is set to 'WhitespaceAnalyzer'

Arkadiusz Palinski

unread,
Jun 21, 2018, 8:39:15 AM6/21/18
to rav...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arkadiusz Palinski

unread,
Jun 22, 2018, 6:38:53 AM6/22/18
to rav...@googlegroups.com
Hi Alexander,

In order to get results ordered by specified boost factors you need to specify order by score() in the query.
 
By default Lucene returns the scores calculated according to specified boosting although we need to tell it to do the ordering.


Arkadiusz Palinski

unread,
Jun 22, 2018, 10:00:24 AM6/22/18
to rav...@googlegroups.com
We have modified the behavior of queries using boost() so they will return results ordered by score by default

Alexander Klaus

unread,
Jun 25, 2018, 3:34:32 AM6/25/18
to RavenDB - 2nd generation document database
Thank you! Will it be available in v4.0.6 or v4.1?

Oren Eini (Ayende Rahien)

unread,
Jun 25, 2018, 3:35:13 AM6/25/18
to ravendb
Both

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages