Leading wildcard character throws error in Lucene.NET

后端 未结 3 722
栀梦
栀梦 2020-12-06 21:11

If the search query contains a leading wildcard character (* or ?), the QueryParser\'s Parse function throws an error.

相关标签:
3条回答
  • 2020-12-06 21:50

    Maybe you have to use a WildcardQuery, but

    ...In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with one of the wildcards...

    0 讨论(0)
  • 2020-12-06 21:59

    You can avoid wildcard queries by utilizing NGramFilter for your index analyzer. Than you have to use search_analyzer without NGramFilter. This way you can search similar to like "%text%" without even needing wildcards. You just enter 'abc' and your index would be searched for all entries containing 'abc' very quickly.

    0 讨论(0)
  • 2020-12-06 22:05

    Set QueryParser.SetAllowLeadingWildcard Method to true. The API page states that "this can produce very slow queries on big indexes" though.

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