David Pilato created LUCENE-4441:
------------------------------------

             Summary: Prefix and postfix all extracted phrases when phrase is 
not complete
                 Key: LUCENE-4441
                 URL: https://issues.apache.org/jira/browse/LUCENE-4441
             Project: Lucene - Core
          Issue Type: Wish
          Components: modules/highlighter
    Affects Versions: 4.0-BETA, 3.6.1
            Reporter: David Pilato
            Priority: Trivial


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 
{code:none} 
"Here is my text"
{code} 
and another like 
{code:none} 
"This is a very long text and I want that Lucene highlight it even if this 
content is very long."
{code} 

When highlighting "text", I get something like:
{code:html} 
"Here is my <B>text</B>"
"This is a very long <B>text</B> and I want that Lucene highlight"
{code}

What I would like to get back is:

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

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:

{code:java}
  // 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;
{code}

I hope this is doable. :-/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to