开发者

In Lucene, using a Standard Analyzer, I want to make fields with spaces and special characters searchable

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 a开发者_JS百科s 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.


Field.Store.YES does not influence the search behaviour on this field. And I'd set IndexField to simply NOT_ANALYZED.

Try to perform search in Luke on full field text 'SKU Number' using KeywordAnalyzer analyzer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜