-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: No short-circuiting in hibernate-search queries?
PostPosted: Thu Jan 21, 2010 12:21 pm 
Newbie

Joined: Thu Jan 21, 2010 12:04 pm
Posts: 1
Hi,

I have a hibernate-search index of about 150.000 Street objects, containing among others the postal code and description.

Now if I have a BooleanQuery like this:

Code:
BooleanQuery query = new BooleanQuery();
query.add(new TermQuery(new Term("postalCode", String.valueOf(postalCode))), Occur.MUST);
query.add(new FuzzyQuery(new Term("description", description), 0.75f), Occur.MUST);


This takes about 120ms.

And this:

Code:
BooleanQuery query = new BooleanQuery();
query.add(new FuzzyQuery(new Term("description", description), 0.75f), Occur.MUST);


Also takes about the same time.

I think that the first query should be way faster, as the more time consuming fuzzy query should only be evaluated for those streets that have a matching postal code.

Any thoughts?


Top
 Profile  
 
 Post subject: Re: No short-circuiting in hibernate-search queries?
PostPosted: Sat Jan 23, 2010 8:05 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I don't know so much about the intrinsics of these type of things. For me this sounds like a question for the Lucene forum. I am sure there you would get a better answer.


Top
 Profile  
 
 Post subject: Re: No short-circuiting in hibernate-search queries?
PostPosted: Sun Jan 24, 2010 5:04 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
This takes about 120ms.

while you should definitely follow Hardy's advice to know about shortcuiting, this time is way too high for a single query on an index of only 150.000 simple elements; my guess is you're actually measuring the time it takes to open the index, which is the same for both cases and is quite more costly than a single query; how are you "benchmarking" this?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.