Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Working with Lucene - a design issue

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am writtng an application in lucene, in which i am retreiving records from db and indexing it. When i search the index, its gives me Lucene's objects in result, but i want it to return collection which contain my own objects, so that it is easy to use.

Say, i indexed the whole book table from db into lucene indexes. Now i am searching the index by author name, i want it to return a collection which contains all Book objects with the desired author.

Thank you,
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The normal use case for Lucene would be that the results contain everything that is needed to display a list of search results, but not more than that (in particular not ALL information). In the case of books this might be title, author and ISBN (and maybe a DB ID if that's needed to identify a book uniquely). In most cases not all information is part of the index anyway, in which case you'd need to hit the DB to get the rest of it - and then you might use SQL to perform the search instead of Lucene to begin with.

So I'd say that the Lucene search should return the minimal set of information needed for display, and once a user selects a particular book, the DB can be accessed to retrieve all information about it.

Or do you have in fact ALL information about the book in the index? Then it shouldn't be hard to recreate a Book object from the search results, but then the question becomes: why use a DB for storing the information in the first place, instead of just a Lucene index?
 
Faraz Ali
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many Thanks,

One more question, whats the best strategy to index multiple tables?

 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what you're getting at - how (or why) would indexing multiple tables be different from indexing a single table? Obviously, you'd want the table name in your Document, so that you'll know from which table a query result originates.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic