Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3141

FastVectorHighlighter - expose FieldFragList.fragInfo for user-customizable FragmentsBuilder

Details

    • New, Patch Available

    Description

      Needed to build a custom highlightable snippet - snippet should start with the sentence containing the first match, then continue for 250 characters.

      So created a custom FragmentsBuilder extending SimpleFragmentsBuilder and overriding the createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList) method - unit test containing the code is attached to the JIRA.

      To get this to work, needed to expose (make public) the FieldFragList.fragInfo member variable. This is currently package private, so only FragmentsBuilder implementations within the lucene-highlighter o.a.l.s.vectorhighlight package (such as SimpleFragmentsBuilder) can access it. Since I am just using the lucene-highlighter.jar as an external dependency to my application, the simplest way to access FieldFragList.fragInfo in my class was to make it public.

      Attachments

        1. LUCENE-3141.patch
          13 kB
          Koji Sekiguchi
        2. lucene-3141-patch-2.diff
          0.7 kB
          Sujit Pal
        3. LIABookTest.java
          38 kB
          Sujit Pal
        4. LIABookTest.java
          38 kB
          Sujit Pal
        5. lucene-3141-patch.diff
          0.6 kB
          Sujit Pal

        Activity

          People

            koji Koji Sekiguchi
            sujitpal Sujit Pal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: