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

Alan Woodward commented on LUCENE-8229:
---------------------------------------

OK, the latest iteration moves the notion of a match containing no hits up to 
the Matches object, and has a default implementation on Weight.  This makes the 
patch much smaller - thanks for the suggestion [~dsmiley]!

I think I'd like to keep the name Matches - we might at some point in the 
future want to add the ability to return matches from DocValues fields, for 
example, so we wouldn't necessarily be returning positions.

Re payloads, that's a convincing use-case.  I have some concerns as to how to 
implement them over composite matches, such as Phrases or Spans, which aren't 
dealt with yet, so let's do that in a follow-up issue.

> Add a method to Weight to retrieve matches for a single document
> ----------------------------------------------------------------
>
>                 Key: LUCENE-8229
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8229
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>            Priority: Major
>         Attachments: LUCENE-8229.patch
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> The ability to find out exactly what a query has matched on is a fairly 
> frequent feature request, and would also make highlighters much easier to 
> implement.  There have been a few attempts at doing this, including adding 
> positions to Scorers, or re-writing queries as Spans, but these all either 
> compromise general performance or involve up-front knowledge of all queries.
> Instead, I propose adding a method to Weight that exposes an iterator over 
> matches in a particular document and field.  It should be used in a similar 
> manner to explain() - ie, just for TopDocs, not as part of the scoring loop, 
> which relieves some of the pressure on performance.



--
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