Lucene Section Index | Page 4
Yes, IndexWriter.addIndexes(Directory) method is thread safe. It is a final synchronized method.
Yes, unlike other types of Lucene queries, Wildcard, Prefix, and Fuzzy queries are case sensitive. That is because those types of queries are not passed through the Analyzer, which is the compone...more
The components responsible for this are various Analyzers. The demos included in Lucene distribution use StopAnalyzer, which filters out non-alphabetic characters. To include non-alphabetic chara...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
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
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
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
Call: TermDocs td = IndexReader.termDocs(Term); Then grab the last Term in TermDocs that this method returns.
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?
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
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.
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.
Fields are returned in the same order they were added to the document.
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