• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Lucene, indexing an Object

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello!

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
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Yeah, but is it art? What do you think tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic