Highlighting whole sentence in Lucene.net 2.9.2

后端 未结 1 346
情深已故
情深已故 2021-01-23 18:03

Currently I\'m working with the Lucene.net 2.9.2 framework. As a result of my search I would like to achieve result page (asp.net) with highlighted text fragment. I would like t

1条回答
  •  醉话见心
    2021-01-23 18:35

    You want to create a new Fragmenter (Similar to SimpleFragmenter). The function you need to adjust is:

    public virtual bool IsNewFragment(Token token)
    {
        bool isNewFrag = token.EndOffset() >= (fragmentSize * currentNumFrags);
        if (isNewFrag)
        {
            currentNumFrags++;
        }
    
        return isNewFrag;
    }
    

    This will likely need some adjustment until you get the correct logic, but that should give you a pretty good head start

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