lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Sorokin" <>
Subject Re: how to craete index with particular ID
Date Wed, 31 May 2006 10:50:30 GMT
Actually you don't need to create text file. Get data from db and
create Document that put in index. At least you must store ID of row
in Document. Or you may store doctitle and docpath too.

For each row you shoul do something like this:

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;

Document doc = new Document();
doc.add(new Field("ID", [here you row ID value], Field.Store.YES,
doc.add(new Field("TITLE", [here value of doctitle field],
Field.Store.NO, Field.Index.TOKENIZED));
doc.add(new Field("PATH", [here value of docpath field],
Field.Store.NO, Field.Index.TOKENIZED));

After searcing you have Hits, get doc from Hits and get value of "ID"
field of that doc - now you may get row from table by ID and receive
any data.

2006/5/31, Amaresh Kumar Yadav <>:
> Hi All,
> Infact i want to search data which is stored  in a table on oracle...
> my table contains two fields "doctitle" and "docpath", first field(doctitle)
> represents location of some document and second field(docpath)represents
> documents title.
> I want to apply lucene search on doctitle.
> What i want to do for  search ...
> First create a text file which contains data(that is retrived by oracle
> query) which is stored in table.
> Now i want to creat index for this file.
> now i want to search on title of document which is stored in the text file.
> after searching i want to disply corresponding path from index file.
> How should i creat such index file  ???
> how should i proceed????
> With Thanks & Regards
> Amaresh
> ----------------------------------------------------------------------
> This email and any files transmitted with it are confidential and are solely for the
use of the individual or entity to which it is addressed. Any use, distribution, copying or
disclosure by any other person is strictly prohibited. If you receive this transmission in
error, please notify the sender by reply email and then destroy the message. Opinions, conclusions
and other information in this message that do not relate to official business of the company
shall be understood to be neither given nor endorsed by NIIT Ltd. or NIIT Technologies Ltd.
Any information contained in this email, when addressed to Clients is subject to the terms
and conditions in governing client contract.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

ICQ: 166072598

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message