Lucene column CLOB indexing
Hi We are looking for a searching mechanism in our application that contains a lot of relational tables containing CLOB content. We have requirements to allow our users to search on this information. We are looking开发者_开发知识库 into Oracle Text, but so far have not found any great news on this product.
We are thinking about reading the CLOB in some process pulling the data and indexing this data. Our users would search and we would map the index to the rowid in our tables and present the results to our users.
Is this a good task for Lucene to handle or I am not thinking properly?
You should be able to add the text in your CLOB to one field, and the row id to another field. If the CLOB is already stored in your DB, don't store it again in the Lucene index (use Store.NO
when adding the text field). Store the row id. When a document matches, you can then pull the row id field from the results & use that to reference into your table.
String rowid = ...; // row id from DB
String text = ...; // data from CLOB;
Document doc = new Document();
doc.add(new Field(FIELD_ID, rowid, Store.YES, Index.NOT_ANALYZED));
doc.add(new Field(FIELD_BODY, text, Store.NO, Index.ANALYZED, TermVector.YES));
精彩评论