lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Behnam Khoshsafar <b.khoshsa...@hamgam.ir>
Subject delete one document from index not working
Date Tue, 23 Jun 2015 11:40:24 GMT
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", doc.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(
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
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", doc.id.toString(), fieldType));
iw.addDocument(iDoc);


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message