newbie question on querying on multiple attributes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

newbie question on querying on multiple attributes

Doug Leeper
I am using Hibernate as my persistence layer and have recently found Hibernate Search and Lucene as a possible solution to my full text search.  However, I am a little fuzzy on what exactly needs to be done in my situation.

In a nutshell, I have a Business object that has multiple of attributes that needs to be indexed (name, summary, products, services, etc)

I would like to provide functionality in my web app that provides a user a single text field that would match Businesses against all the identified attributes.

I am assuming there are more than one option...but what is the best approach to accomplishing this scenario?

I am assuming that i need to create different terms for each indexed attribute...correct?  If so, do I need to create a BooleanQuery for each term?

I am sure there is an example out there...but I haven't found one or have misunderstood what I have seen so far.  So if there is a something out there, could someone direct me to it?

Thanks in advance,
- Doug
Reply | Threaded
Open this post in threaded view
|

Re: newbie question on querying on multiple attributes

Stephane Nicoll
Consider the use of the ClassBridge in Hibernate Search. Very useful. It
basically allows you to merge multiple fields of your hibernate entity into
a single lucene field. Once this is done, you can query this single field
from lucene without the need for BooleanQuery.

HTH,
St├ęphane



On Tue, Dec 16, 2008 at 4:51 PM, Doug Leeper <[hidden email]> wrote:

>
> I am using Hibernate as my persistence layer and have recently found
> Hibernate Search and Lucene as a possible solution to my full text search.
> However, I am a little fuzzy on what exactly needs to be done in my
> situation.
>
> In a nutshell, I have a Business object that has multiple of attributes
> that
> needs to be indexed (name, summary, products, services, etc)
>
> I would like to provide functionality in my web app that provides a user a
> single text field that would match Businesses against all the identified
> attributes.
>
> I am assuming there are more than one option...but what is the best
> approach
> to accomplishing this scenario?
>
> I am assuming that i need to create different terms for each indexed
> attribute...correct?  If so, do I need to create a BooleanQuery for each
> term?
>
> I am sure there is an example out there...but I haven't found one or have
> misunderstood what I have seen so far.  So if there is a something out
> there, could someone direct me to it?
>
> Thanks in advance,
> - Doug
> --
> View this message in context:
> http://www.nabble.com/newbie-question-on-querying-on-multiple-attributes-tp21035723p21035723.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Large Systems Suck: This rule is 100% transitive. If you build one, you
suck" -- S.Yegge
Reply | Threaded
Open this post in threaded view
|

Re: newbie question on querying on multiple attributes

Hardy Ferentschik-5
Hi,

instead of the ClassBridge you can just annotate all the properties you  
want to index with
@Field and build a BooleanQuery out of the input field. Indexing the  
properties into
separate document fields is probably more extendable in the future when  
you for example
only want to search on a subset of the properties.

I recommend you read through the online documentation of Hibernate Search  
and you can also
ask question at the Hibernate Search Forum -  
http://forum.hibernate.org/viewforum.php?f=9
which is probably a more appropriate then this mailing list.

--Hardy

On Tue, 16 Dec 2008 16:57:44 +0100, Stephane Nicoll  
<[hidden email]> wrote:

> Consider the use of the ClassBridge in Hibernate Search. Very useful. It
> basically allows you to merge multiple fields of your hibernate entity  
> into
> a single lucene field. Once this is done, you can query this single field
> from lucene without the need for BooleanQuery.
>
> HTH,
> St├ęphane

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]