Lucene - Core
  1. Lucene - Core
  2. LUCENE-2464

FastVectorHighlighter: add a FragmentBuilder to return entire field contents

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1
    • Component/s: modules/highlighter
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      In Highlightrer, there is a Nullfragmenter. There is a requirement its counterpart in FastVectorhighlighter.

      1. LUCENE-2464.patch
        6 kB
        Koji Sekiguchi

        Issue Links

          Activity

          Hide
          Antony Stubbs added a comment -

          Related to : SOLR-2998

          Standard highlighter would, specifically LuceneGapFragmenter, only return a single highlighted value from mutlivalue field highlighting. I can't see how to get the same response from FVH, it seems to insist on concatenating all values of a multivalue field together (or at least surrounding values on highlight matches.

          Show
          Antony Stubbs added a comment - Related to : SOLR-2998 Standard highlighter would, specifically LuceneGapFragmenter, only return a single highlighted value from mutlivalue field highlighting. I can't see how to get the same response from FVH, it seems to insist on concatenating all values of a multivalue field together (or at least surrounding values on highlight matches.
          Hide
          Grant Ingersoll added a comment -

          Bulk close for 3.1

          Show
          Grant Ingersoll added a comment - Bulk close for 3.1
          Hide
          Lukas Vlcek added a comment -

          I found that even if the SingleFragListBuilder is used then client has explicitly ensure that numberOfFragments > 0 otherwise highlighter produces empty output.

          The thing is that

           FastVectorHighlighter.getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments );

          delegates to

           BaseFragmentsBuilder.createFragments( IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments, String[] preTags, String[] postTags, Encoder encoder);

          which needs to be passed maxNumFragments > 0 in order to produce any non-empty output.

          Show
          Lukas Vlcek added a comment - I found that even if the SingleFragListBuilder is used then client has explicitly ensure that numberOfFragments > 0 otherwise highlighter produces empty output. The thing is that FastVectorHighlighter.getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments ); delegates to BaseFragmentsBuilder.createFragments( IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments, String[] preTags, String[] postTags, Encoder encoder); which needs to be passed maxNumFragments > 0 in order to produce any non-empty output.
          Hide
          Koji Sekiguchi added a comment -

          trunk: Committed revision 960611.
          branch_3x: Committed revision 960615.

          Show
          Koji Sekiguchi added a comment - trunk: Committed revision 960611. branch_3x: Committed revision 960615.
          Hide
          Koji Sekiguchi added a comment -

          I think this is ready to commit. Will commit shortly.

          Show
          Koji Sekiguchi added a comment - I think this is ready to commit. Will commit shortly.
          Hide
          Koji Sekiguchi added a comment -

          I implemented SingleFragListBuilder that generates one WeightedFragInfo object. Using both this class and SimpleFragmentsBuilder, you can get an entire field contents as described in Javadoc.

          FastVectorHighlighter h = new FastVectorHighlighter( true, true,            
            new SingleFragListBuilder(), new SimpleFragmentsBuilder() );              
          

          SingleFragListBuilder ignores fragCharSize... I think createFieldFragList() shouldn't take fragCharSize argument (the necessity of fragCharSize depends on FragListBuilder impl). I want to change the interface in the future.

          Show
          Koji Sekiguchi added a comment - I implemented SingleFragListBuilder that generates one WeightedFragInfo object. Using both this class and SimpleFragmentsBuilder, you can get an entire field contents as described in Javadoc. FastVectorHighlighter h = new FastVectorHighlighter( true , true , new SingleFragListBuilder(), new SimpleFragmentsBuilder() ); SingleFragListBuilder ignores fragCharSize... I think createFieldFragList() shouldn't take fragCharSize argument (the necessity of fragCharSize depends on FragListBuilder impl). I want to change the interface in the future.

            People

            • Assignee:
              Koji Sekiguchi
              Reporter:
              Koji Sekiguchi
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development