Howto perform a 'contains' search rather than 'starts with' using Lucene.Net

前端 未结 2 1990
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 11:13

We use Lucene.NET to implement a full text search on a clients website. The search itself works already but we now want to implement a modification.

Currently all te

2条回答
  •  时光说笑
    2020-12-14 11:41

    @Simon Svensson probably gave the better answer (i.e. you don't need this), but if you do, you should use a Shingle Filter.

    Note that this will make your index massively larger, since instead of just storing "orchestra", you will store "orc", "rch", "che", "hes"... But just having a plain term query with leading wildcards will be massively slow. It will essentially have to look through every single term in your corpus.

提交回复
热议问题