Lucene search and underscores

后端 未结 2 2035
北荒
北荒 2020-12-18 00:28

When I use Luke to search my Lucene index using a standard analyzer, I can see the field I am searchng for contains values of the form MY_VALUE. When I search for field:\"MY

相关标签:
2条回答
  • 2020-12-18 01:08

    I don't think you'll be able to use the standard analyser for this use case.

    Judging what I think your requirements are, the keyword analyser should work fine for little effort (the whole field becomes a single term).

    I think some of the confusion arises when looking at the field with luke. The stored value is not what's used by queries, what you need are the terms. I suspect that when you look at the terms stored for your field, they'll be "my" and "value".

    Hope this helps,

    0 讨论(0)
  • 2020-12-18 01:29

    It doesn't look like you used the StandardAnalyzer to index that field. In Luke you'll need to select the analyzer that you used to index that field in order to match MY_VALUE correctly.

    Incidentally, you might be able to match MY_VALUE by using the KeywordAnalyzer.

    0 讨论(0)
提交回复
热议问题