Lucene search and underscores

后端 未结 2 2042
北荒
北荒 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,

提交回复
热议问题