-->
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 determine the Field that matched the search?
PostPosted: Thu Aug 20, 2009 9:33 am 
Newbie

Joined: Fri Aug 08, 2008 9:00 am
Posts: 5
Hey,

Let's say I've got an entity Person which has a Collection of Elements, e.g. List<Attribute>. It's no problem to retrieve a List of People which contain an Attribute that matches the searchstring. But how do I know which certain Attribute matches the search? What I want to have is a "found in"-function, i.g. Person A. Smith - string "Java" found in "Certificates"

Is there a possibility to implement this feature?

Thanks in advance,
Seb


Top
 Profile  
 
 Post subject: Re: How to determine the Field that matched the search?
PostPosted: Sat Aug 22, 2009 11:28 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

it depends a little on your use case. For example if you are indexing text and you want to highlight where in the text the match occurred you could use the Lucene Highlighter API - also discussed here

However, you seem to be interested in which entity property (or Document field) a match occurred. There is no generic API for that. A straight forward approach would be to iterate the results yourself and find where the matched occur. Alternatively, you could use the Lucene explain feature (see discussion here). Unfortunately, the explain functionality is not very per formant and more of a debugging tool.

It would be interesting to get some more feedback from the community about these type of use cases and how they got solved.

--Hardy


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.