lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Woodward (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LUCENE-4479) TokenSources.getTokenStream() doesn't return correctly for termvectors with positions but no offsets
Date Fri, 12 Oct 2012 16:43:03 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alan Woodward updated LUCENE-4479:
----------------------------------

    Attachment: LUCENE-4479.patch

Patch, changing the API slightly:

- getTokenStream(Terms, bool) now throws IllegalArgumentException if the Terms does not have
offsets.

- renames getTokenStream(IndexReader, int, String) to getTokenStreamWithOffsets.  Not sure
I like the name...  Also added some javadocs here.  Instead of throwing IllegalArgumentExceptions,
this just returns null if it can't build a tokenstream for whatever reason (no termvector,
no offsets or positions).

The only API consumer here is DefaultSolrHighlighter, which I've edited accordingly.  I also
added a test to Solr to ensure that fields with termvectors and positions but no offsets are
correctly highlighted.

All tests pass
                
> TokenSources.getTokenStream() doesn't return correctly for termvectors with positions
but no offsets
> ----------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4479
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4479
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/highlighter
>    Affects Versions: 4.0
>            Reporter: Alan Woodward
>            Priority: Minor
>         Attachments: LUCENE-4479.patch, LUCENE-4479.patch
>
>
> The javadocs for TokenSources.getTokenStream(Terms, boolean) state:
> "Low level api. Returns a token stream or null if no offset info available
> in index. This can be used to feed the highlighter with a pre-parsed token
> stream"
> However, if the Terms instance passed in has positions but no offsets stored, a TokenStream
is incorrectly returned, rather than null.
> This has the effect of incorrectly highlighting fields with term vectors and positions,
but no offsets.  All highlighting markup is prepended to the beginning of the field.

--
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message