[ 
https://issues.apache.org/jira/browse/LUCENE-8270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461915#comment-16461915
 ] 

David Smiley commented on LUCENE-8270:
--------------------------------------

I believe the semantics of term() should simply be the term at the particular 
match position.  That ought to be one term unless the indexed data had more 
than one term at this position and furthermore the query matched more than one 
of the terms at this position.  In this very edge case, I don't care much which 
term is returned :) 

I think the confusion here is what the underlying semantics are for a 
MatchesIterator when we have something like a phrase.  If we think of 
MatchesIterator as very similar to OffsetsEnum in the UnifiedHighlighter, then 
we iterate to each word/term.  Then term() is straight-forward, and so is a 
hypothetical getPayload().  Lets just do this?  Adding a freq() too would make 
my day :)  In this scenario there is no notion of a position span; it's a 
position-by-position view.  We could add a getPosition but wouldn't need a 
start/end.

If the matches() caller wanted to detect the "span" of say a phrase, (maybe to 
highlight it nicer as one markup tag enclosing pair?) then maybe handle that 
with some new method like spanOccurrence():int which could return which 
span/occurrence the MatchesIterator is currently at?

 

> Remove MatchesIterator.term()
> -----------------------------
>
>                 Key: LUCENE-8270
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8270
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>            Priority: Major
>         Attachments: LUCENE-8270.patch
>
>
> As discussed on LUCENE-8268, we don't have a clear use-case for this yet, and 
> it's complicating adding Matches to phrase queries, so let's just remove it 
> for now.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to