Why is it important to use the same analyzer type during indexing and search?
The analyzer controls how the text is broken into terms which are then used to index the document. If you are using an analyzer of one type to index and an analyzer of a different type to parse the search query, it is possible that the same word will be mapped to two different terms and this will result in missing or false hits. NOTE: It’s not a rule that the same analyzer be used for both indexing and searching, and there are cases where it makes sense to use different ones (ie: when dealing with synonyms). The analyzers must be compatible though. Also be careful with Fields that are not tokenized (like Keywords). During indexation, the Analyzer won’t be called for these fields, but for a search, the QueryParser can’t know this and will pass all search strings through the selected Analyzer. Usually searches for Keywords are constructed in code, but during development it can be handy to use general purpose tools (e.g. Luke) to examine your index. Those tools won’t know which fields are