-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to use Lucene search engine with the help of hibernate
PostPosted: Wed Feb 11, 2004 7:58 am 
Newbie

Joined: Wed Feb 11, 2004 6:37 am
Posts: 2
Location: Delhi,India
I am saving my txt documents in the postgres database.
Now I have to search these documents using lucene search engine with the help of Hibernate.

I also read the reference given in the hibernate site on page 138.html
but that I think was to search any string which has been stored in the database. I am not able to do that for documents that i have saved in the database.

Please tell me how to go about it ??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 8:46 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
There are a lot of ways to implement it.
It you need to search any string in database and your search result is
"TableName, FieldName, OID " use system tables and dynamic sql to reindex data periodicaly or use some trivial table (tableName,OID, data, timestamp) and trigger to log modifiacations (It has metadata and can be single procedure for all tables) and reindex modified data only.

Why do you think hibernate can help to index and to search text ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 9:00 am 
Newbie

Joined: Wed Feb 11, 2004 6:37 am
Posts: 2
Location: Delhi,India
Thanks for your reply. Yes, there can be lot of ways of implementing it. but actually I am already using hibernate as ORM and postgres as database in our application. There is also functinality of saving documents in the database. Now I want to provide one more feature to the user that he can also search these documents(saved in the database) for any string. I have to use lucene for it . Now This creating problem using lucene with hibernate . I am not able to do this. Have you any idea of this?

Regards,
Ankur


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 9:47 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
The answer is all there.

Use the approach in 136.html to update your Lucene index with what you want to search on.

Use whatever mechanism to do the Lucene search. This will return Lucence Documents that have 'id' and 'classname' keywords attached to them.

To get back to the Hibernate object,

session.load(Class.forName(classname), id);


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2004 9:50 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I use lucene for very trivial use case without database, I just store document itself in lucene index.


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