lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: delete one document from index not working
Date Tue, 23 Jun 2015 13:57:27 GMT
You should not setTokenized(true) for your id field?  This splits it
into tokens according to your analyzer.

Mike McCandless

On Tue, Jun 23, 2015 at 7:40 AM, Behnam Khoshsafar
<> wrote:
> I'm using Lucene 5.1.0 to index a document and search it. I have a lot of documents,
over 1000000, which are stored in a database. When I start running the project for the first
time, I use Lucene to index these documents. Now I want to delete one document from the database
and indexes. I also choose an id for each index. I am using the following command to delete,
but it's delete all index.
> iw.deleteDocuments(new Term("id",;
> Also, I used a Query to delete but it's delete all index.
> I add documents to the index as follows:
> iDoc = new org.apache.lucene.document.Document();
> FieldType fieldType = new FieldType();
> fieldType.setIndexOptions(
> fieldType.setTokenized(true);
> fieldType.setStored(true);
> fieldType.setOmitNorms(true);
> fieldType.setStoreTermVectors(true);
> fieldType.setStoreTermVectorOffsets(true);
> fieldType.setStoreTermVectorPayloads(true);
> fieldType.setStoreTermVectorPositions(true);
> iDoc.add(new Field("id",, fieldType));
> iw.addDocument(iDoc);

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

View raw message