Query parsed to: +delet +indexread
1 - 9 of 9 results (Page 1 of 1)

2.2.3 : Undeleting Documents

starts on page 36 under section 2.2 (Basic index operations) in chapter 2 (Indexing)

...Because Document deletion is deferred until the closing of the IndexReader instance, Lucene allows an application to change its mind and undelete Documents that have been marked as deleted. A call to IndexReader's undeleteAll() method undeletes all deleted Documents by removing all .del files from the index directory. Subsequently closing the IndexReader instance therefore leaves all Documents ... instance of IndexReader that was used to delete the Documents in the first place....

2.2.2 : Removing Documents from an index

starts on page 33 under section 2.2 (Basic index operations) in chapter 2 (Indexing)

... called IndexReader. This class doesn't delete Documents from the index immedi- ately. Instead, it marks them as deleted, waiting for the actual Document deletion until IndexReader's close() method ... the index with IndexReader, the maxDoc() method returns 1 rather than 2, because after a delete ... Document number, as we've done, you can delete several Documents by using IndexReader's delete(Term) method ... IndexReader like so: IndexReader reader = IndexReader.open(dir); reader.delete(new Term("city", "Amsterdam...

2.9.2 : Thread-safety

starts on page 60 under section 2.9 (Concurrency, thread-safety, and locking issues) in chapter 2 (Indexing)

... adding new documents to an index, you must close all IndexReader instances that have deleted Documents from the same index. Similarly, before deleting or updat- ing documents in an index, you must ... is being deleted (IndexReader). A document can't be deleted (IndexReader) while the index is being optimized (IndexWriter). A document can't be deleted (IndexReader) while the index is being merged ... instances of IndexWriter or IndexReader isn't allowed, as shown in table 2.2, both of these classes...

2.2.4 : Updating Documents in an index

starts on page 36 under section 2.2 (Basic index operations) in chapter 2 (Indexing)

...", "Amsterdam")); Delete Documents IndexReader reader = IndexReader.open(dir); with "Amsterdam" in city field ... , it's best to do so in batches. Follow these steps: 1 Open IndexReader. 2 Delete all the Documents you need to delete. 3 Close IndexReader. 4 Open IndexWriter. 5 Add all the Documents you need to add ... list. Lucene doesn't offer an update(Document) method; instead, a Document must first be deleted ... by first deleting them and then re-adding them public class DocumentUpdateTest extends...

2.9.1 : Concurrency rules

starts on page 59 under section 2.9 (Concurrency, thread-safety, and locking issues) in chapter 2 (Indexing)

... to close the IndexReader that was used to delete documents Disallowed from an index before opening ... that was used to add documents to an Disallowed index before opening a new IndexReader to delete or update ... , and deletion; when using them, you need to follow certain rules to avoid index corruption ... documents are being added to the index, updated, or deleted from the index. Only a single ... IndexReader at a time. Based on these concurrency rules, we can create a more comprehensive set...

2.9.3 : Index locking

starts on page 62 under section 2.9 (Concurrency, thread-safety, and locking issues) in chapter 2 (Indexing)

... obtained by IndexReader when it's used for deleting Documents, undeleting them, or setting Field norms ... IndexWriter Constructor close() Lock released when IndexWriter is closed write.lock IndexReader delete(int ... is used whenever segments are being read or merged. It's obtained by an IndexReader before it reads the segments file, which names all index segments, and it's released only after IndexReader has opened ... are only opened or deleted and only a small segments file is written to disk. Table 2.4 summarizes all...

10.7.3 : Building the index

starts on page 374 under section 10.7 (I love Lucene: TheServerSide) in chapter 10 (Case studies)

... should be indexed. In this case, instead of creating a new index, we simply delete the record (if it already exists) and insert the latest data into it. How do you delete a record in Lucene again? We need the org.apache.lucene. index.IndexReader. The snippet that does the work is shown in listing 10.7. Listing 10.7 Snippet from IndexHolder that deletes the entry from the index if it is already there IndexReader reader = null; try { this.close(); // closes the underlying index writer reader...

Upgrading example code for Lucene 2.0

To bring the LIA code examples up to date with Lucene 2.x API there are only a few minor changes necessary: Replace all BooleanQuery.add's, e.g.:
 - subjectQuery.add(tq, false, false); + subjectQuery.add(tq, BooleanClause.Occur.SHOULD); 
Substitute RangeFilter for DateFilter usage, e.g.:
 - DateFilter filter = new DateFilter("modified", jan1, dec31); + RangeFilter filter = new RangeFilter("modified", jan1, dec31, true, true); 
NOTE: The dates are now String's generated by DateUtils.dateToString() and incompatible with DateField

Replace all Field.Keyword/UnStored/Text/UnIndexed with the enumerated types, e.g.:

 - doc.add(Field.Keyword("animal", animal)); + doc.add(new Field("animal", animal, Field.Store.YES, Field.Index.UN_TOKENIZED)); 

Rename PhrasePrefixQuery -> MultiPhraseQuery

Use instance of QueryParser instead of static parse method, e.g.:

 - Query query = QueryParser.parse(expression, "contents", analyzer); + Query query = new QueryParser("contents", analyzer).parse(expression) 
QueryParser subclasses adjusted for overridden getXXXQuery method signatures.

IndexReader.delete() updated to be IndexReader.deleteDocument/.deleteDocuments()

IndexWriter internal configuration values now accessed through getters/setters rather than the fields directly, with minMergeDocs renamed as setMaxBufferedDocs().

QueryParser.setLowercaseWildcardTerms() replaced with .setLowercaseExpandedTerms()

QueryParser.getRangeQuery() still uses DateField when constructing a RangeQuery. If your index is built using DateTools, you will need to subclass and override, as shown in QueryParserTest.testRangeQuery(). [Permalink]

index

starts on page 416

... 11 IndexReader 199 Konrad, Karsten 344 dates 39-40, 216 deleting documents 375 Korean analysis ... 26 DefaultSimilarity 79 using HitCollector 203 TheServerSide usage 371 deleting documents 375 within a Query...