In Lucene, using a Standard Analyzer, I want to make fields with spaces and special characters(underscore,!,@,#,….) searchable.
I set IndexField to NOT_ANALYZED_NO_NORMS and Field.Store.YES
When I look at my index in LUKE, the fields are as I expected, a value such as:
‘SKU Number’, yet when I search for ‘SKU’ or ‘SKU*’ nothing comes up.
What am I missing?
Searching for ‘SKU’ won’t work because you indexed with NOT_ANALYZED; ‘SKU Number’ is the entire indexed term. If you want words split by whitespace, that’s what ANALYZED is for.
Now doing a prefix search, ‘SKU*’, would work except by default the lucene QueryParser lowercases expanded terms. Set lowercaseExpandedTerms on the parser to False.