When creating org.apache.lucene.document.Document
during indexing I create a org.apache.lucene.document.StringField
which has multiple spaces together e.g. "ID____45_2013". I use org.apache.lucene.analysis.standard.StandardAnalyzer
for creating the index and for querying it.
When querying index using phrases with multiple spaces e.g. "ID__45_2013" (where _ is a space) I get an empty result.
I have examined my query using luke and I realized that multiple spaces are parsed into one space.
What should I do to be able to use multiple spaces in query phrase and get the right result?
use keyword analyser for both indexing and searching
http://lucene.apache.org/core/3_0_3/api/all/org/apache/lucene/analysis/KeywordAnalyzer.html