botah wrote:
All,
So, my question is this. Which is the best approach:
A) Use lucene to index and search and store all attributes that I might want in all views then rehydrate my POJOs using setters.
Do you find that your pojo attributes lost something inhiberante index? Kind of ucool.
botah wrote:
B) Use lucene to index and search, but only fetch the PK from lucene and do a hibernate session.load(pk) to get the REAL object? I am worried about the double search hit. But this approach is extendable nicely. This might look something like this:
Code:
searcher = new IndexSearcher(Case.LUCENE_SEARCH_INDEX);
Hits hits = searcher.search(query);
logger.info(hits.length() + " total matching documents");
for (int i = 0; i < hits.length(); i++) {
Document doc = hits.doc(i);
String id = doc.get("id");
Case aCase = hibSession.load(id);
results.add(aCase);
}
I prefer this approach. I have to indexcontents of my infomation management system - so complicated hibernate structure is first rendered to text, using velocity.
( like subchapter of book, news entry or whatever )
Then I store keywords ( explicitely given ) and fulltext
( maybe title or whatever ) in search document fields.
As you may expect, keywords are indexed / stored ,
full text only indexed and title also indexed / stored
Then on hit I retrieve ID of piece of information ( be it
news, chapter or even pictire ) - and render it.
A must also say, that big parts of my information are pretty static,
so I do batch reindexing from time to time.
botah wrote:
C) Bag Lucene all together and do straight HQL queries and loose some of the rich text searches the Lucene gives me?
Worst scenario.... Guy which was before me on this task
created a really lame database, with search that dod not found anything :) ( though he did not used hibernate for this,
it was plain jdbc... )
botah wrote:
D) Other
Thanks in advance