WhereEquals differences in raven 3 vs raven 4

45 views
Skip to first unread message

Wallace Turner

unread,
Dec 5, 2017, 8:39:33 AM12/5/17
to RavenDB - 2nd generation document database

I have an index that is returning results in raven3 but after upgrading to raven 4 the 'same' query does not produce any results:

(apologies in advance for all the screenshots but it really is the easiest way to show this imho)



The field in question is analyzed and appears to have been ported to raven4 correctly:


Raven3.0




Raven 4.0 RC2





When I query this (either in code or from the studio) i get results in raven3.0:




Now the 'same' query in Raven4.0 (using the same code as b4 or with studio)



No results. I've tried also


from index 'Property/ByAddress'

where  search(Address, "Napier Street Nedlands WA 6009")


however this seems to return *many* more results and they look nothing like the results from raven3.0


Can you please help what is the syntax to make the query work like it did in 3.0 ?





Oren Eini (Ayende Rahien)

unread,
Dec 5, 2017, 8:41:47 AM12/5/17
to ravendb
Try:

where lucene(Address, '"Napier Street Nedlands WA 6009"')

Hibernating Rhinos Ltd  

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

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

 


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wallace Turner

unread,
Dec 5, 2017, 8:52:58 AM12/5/17
to RavenDB - 2nd generation document database
1.2million results! :/ (about 1/3 of all docs)  
raven3 returns ~15 



To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Dec 5, 2017, 9:00:20 AM12/5/17
to ravendb
Can you send us an export with some sample data so we can look at this?
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Wallace Turner

unread,
Dec 5, 2017, 9:13:05 AM12/5/17
to RavenDB - 2nd generation document database
sharing file with you. its a raven4 backup

Wallace Turner

unread,
Dec 5, 2017, 9:19:05 AM12/5/17
to RavenDB - 2nd generation document database
ok its shared however its from a raven3.0 smuggler backup (not 4 like i said b4)


On Tuesday, 5 December 2017 22:00:20 UTC+8, Oren Eini wrote:
Can you send us an export with some sample data so we can look at this?

Now the 'same' query in Raven4.0 (using the same code as b4 or with studio)




No results. I've tried also


from index 'Property/ByAddress'

where  search(Address, "Napier Street Nedlands WA 6009")


however this seems to return *many* more results and they look nothing like the results from raven3.0


Can you please help what is the syntax to make the query work like it did in 3.0 ?





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

Wallace Turner

unread,
Dec 5, 2017, 9:31:06 PM12/5/17
to RavenDB - 2nd generation document database
i tested it earlier on that backup i shared with you. this is the recreate
1) create TestDb
2) Import ravendump file
3) wait for indexes
4) run this query:
from index 'Property/ByAddress'
where  lucene(Address, "Napier Street Nedlands WA 6009")

whether you use search or lucene makes no difference; ~1.25mil records are returned.

As an aside an exact search returns no results:

from index 'Property/ByAddress'
where  Address="40 Napier Street Nedlands WA 6009"

Oren Eini (Ayende Rahien)

unread,
Dec 6, 2017, 4:30:42 AM12/6/17
to ravendb
Here is what you need to do:
Inline image 1

The query is:
from index 'Property/ByAddress'
where search(Address,'Napier Street Nedlands WA 6009', and)

The key here is that we need to tell the query that we want to AND all of those together.

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.

Wallace Turner

unread,
Dec 6, 2017, 7:02:20 AM12/6/17
to RavenDB - 2nd generation document database
thanks, that fixes it in the studio (i did not see that 'and' operator in the raven4 docs)

this may be considered a breaking change for raven3 to 4?

e.g. for anyone else who comes across this

query = query.WhereEquals("Address", "someval");

should be replaced with:

query = query.Search(indexField, sanitizedSearchTerm.SearchTerm, SearchOperator.And);


?

Looking back at this I'm guessing in raven3 i should have been using `Search` instead of `WhereEquals` 

On Wednesday, 6 December 2017 17:30:42 UTC+8, Oren Eini wrote:
Here is what you need to do:


Reply all
Reply to author
Forward
0 new messages