freinds I m using Lucene for searching and sorting string data on my web pages. the problem is that Lucene stores/index only text(as far as I know) while i want to store java objects, in other words when a search is found in a document I would be able to retreive a particular Object associated with that document. Is it possible that I store Object's hash Code in string form to the Lucene indexed directory and retrieve object on the basis of hash code. In simple words forget indexing forget Lucene just tell me is it possible that if u have hash code (String form) ,can u reference/retrieve an existing object using that hash code,if yes then how ? I wil be very thankful to u if u solve my problem.
Take care, Bye.
sharp shooter, and author
posted 11 years ago
The way I approach this is to store the primary key of the object alongside the attributes/fields that you are indexing. That way, you can grab the key and lookup the appropriate object when performing a search.
Hashcode should work, but only if you know it's unique and you have a way to convert from a hashcode back to the object. You'll need to write this yourself.