-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to find out which Lucene field returned with hits?
PostPosted: Tue Jun 07, 2011 11:53 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Hi,

I have a classical problem in which I have localized data in 3 different languages for a color. Example

color_English=red
color_French=rouge
color_German=rot

All of these fields are for a single document.

Now I insert a search term "rot" and search thru all the fields in the document. How do I know from Hibernate Search as to which field in the above list fetched/matched the term?

Thanks
David


Top
 Profile  
 
 Post subject: Re: How to find out which Lucene field returned with hits?
PostPosted: Wed Jun 08, 2011 5:42 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
if you created the query targeting all three fields, then you can not. You could create a different query for each field, or post-process your results to look into the actual values you have loaded.

You could also do a projection query on each query to fetch the document ids only, and then do some bitmask AND against the different results: this bitmask would serve you as flags "yes/no" for each match option.

This is actually how filters work, so in case you need to squeeze more performance you could create a filter from your query targeting only the "color_English", and create another query targeting all fields, applying the first one as a filter on the second one.

Generally speaking, doing a search on Lucene is extremely fast, what is slow is updating & writing to the index, so unless you have a specific need for it you should not be worried in making an additional query.

_________________
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.  [ 2 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.