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

Prefix and postfix all extracted phrases when phrase is not complete

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 3.6.1, 4.0-BETA
    • Fix Version/s: None
    • Component/s: modules/highlighter
    • Labels:
    • Lucene Fields:
      New

      Description

      Heya,
      I would like to be able to prefix and postfix phrases when extracted text is not a complete phrase.

      For example, let's say I have a phrase like

       
      "Here is my text"
      

      and another like

       
      "This is a very long text and I want that Lucene highlight it even if this content is very long."
      

      When highlighting "text", I get something like:

       
      "Here is my <B>text</B>"
      "This is a very long <B>text</B> and I want that Lucene highlight"
      

      What I would like to get back is:

       
      "Here is my <B>text</B>"
      "This is a very long <B>text</B> and I want that Lucene highlight [...]"
      

      As you can see, the " [...]" is added at the end because we extracted content from the field and not all the field.

      So, we can add some options to Highlighter (FastVectorHighlighter) as follow:

        // Default values :
        // preLine = null;
        // postLine = null;
        public final String[] getBestFragments( final FieldQuery fieldQuery, IndexReader reader, int docId,
            String fieldName, int fragCharSize, int maxNumFragments,
            FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder,
            String[] preTags, String[] postTags, String preLine, String postLine, Encoder encoder ) throws IOException;
      

      I hope this is doable. :-/

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dadoonet David Pilato
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: