-->
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.  [ 4 posts ] 
Author Message
 Post subject: to get indexed properties with HIBERNATE SEARCH
PostPosted: Sat Nov 29, 2008 12:37 pm 
Beginner
Beginner

Joined: Tue Feb 12, 2008 3:53 pm
Posts: 38
Hi,
I use HIBERNATE SEARCH to make fulltext research. I have indexed several properties of my objects. Later on, in my java code, I want to get in a generic manner the indexed properties of my objects in order to build my request. This would give me for example in my Lucene request :

Code:
String queryString =getproperty1FromObject1()+":"+searchString+" OR " +getproperty2FromObject1()+":"+searchString


getproperty1FromObject1() would give me for example the indexed property "name" of my indexed object  "Item"
getproperty2FromObject1() would give me for example the indexed property "description" of my indexed object  "Item"


Do you know how I can get in a generic manner these indexed properties relatively to my indexed objects ? Thank-you in advance for your answers


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 30, 2008 3:07 am 
Beginner
Beginner

Joined: Tue Feb 12, 2008 3:53 pm
Posts: 38
Hi,
I have been awkward when I talked about indexed properties of indexed objects. It is in fact indexed properties of indexed classes. The problem is indeed to recover in a generic way indexed properties from indexed classes.
Thank you for your answers.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 30, 2008 11:55 am 
Hibernate Team
Hibernate Team

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

can you maybe describe your usecase a little more. Normally, you know what properties you have indexed and how to construct your query.

At the moment there is no public meta data API which would let you discover which properties are indexed. You could try to get hold of the DocumentBuilder for a given entity by using the SearchFactory. However you will have to case to the specific implementation SearchFactoryImpl. The DocumentBuilder contains parts of the meta information you are after. If you go down this path be aware that this is not a public API and could change at any time.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 11:46 am 
Newbie

Joined: Wed Aug 06, 2008 3:14 am
Posts: 3
a little workaround (out of hibernate search scope) is to directly use the lucene native API with an IndexReader.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.