Lucene Section Index | Page 4
Is it possible to use a DateFilter without a query? I would like to get all documents from a certain period of time WITHOUT specifying any additional query terms except for the date range.
This cannot be done with Lucene out of the box, however there is a way to do this. One solution is to add a field with a known and constant value to each document in the index. Then searching fo...more
Yes, IndexWriter.addIndexes(Directory) method is thread safe. It is a final synchronized method.
There is a variable called slop in PhraseQuery that allows you to perform NEAR/WITHIN-like queries. By default, slop is set to 0 so that only exact phrases will match. However, you can alte...more
This question is often brought up because of the 2GB file size limit of some 32-bit operating systems. This is a slightly modified answer from Doug Cutting: The easiest thing is to set Index...more
Does MultiSearcher do anything particularly efficient to search multiple indices or does it simply search one after the other?
MultiSearcher searches indices sequentially. Multi-CPU machines would benefit from a multi-threaded version of MultiSearcher that performs multiple searches in parallel. more
Call: TermDocs td = IndexReader.termDocs(Term); Then grab the last Term in TermDocs that this method returns.
There is no direct way of doing that. You could add a term "x" to every document, and then search for "+x -y" to find all of the documents that don't have "y". Note that for large collections th...more
Fields are returned in the same order they were added to the document.
If you know the document number of a document that you want to delete you may use: IndexReader.delete(docNum) That will delete the document numbered docNum from the index. Once a document is de...more
How do I restrict searches to only return results from a limited subset of documents in the index (e.g. for privacy reasons)?
How do I restrict searches to only return results from a limited subset of documents in the index (e.g. for privacy reasons)? What is the best way to approach this?
What happens when you IndexWriter.add() a document that is already in the index? Does it show up twice or does it overwrite the previous document?
There will be multiple copies of the same document in the index.
Yes, IndexSearcher is thread-safe. Multiple search threads may access the index concurrently without any problems.
Yes, QueryParser is thread-safe. Its static parse method creates a new instance of QueryParser each time it is called.
Lucene supports wild card queries which allow you to perform searches such as book*, which will find documents containing terms such as book, bookstore, booklet, etc. Lucene refers to this ...more