You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Michael Sokolov (Jira)" <ji...@apache.org> on 2021/02/18 14:57:00 UTC

[jira] [Commented] (LUCENE-9640) Add TrackingQuery to track matching documents

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

Michael Sokolov commented on LUCENE-9640:
-----------------------------------------

I worked up a version of this which in createWeight caches an array of Scorers, one for each leaf, and then supports a \{matched(int leaf, int docid)} intended to be called from \{LeafCollector.collect()} for each document, for each such tracked query which checks whether the leaf's scorer has advanced to the given docid. This is lightweight and works nicely, but relies on the TrackingQuery maintaining per-execution state, so it can only be used once, is not thread-safe, etc.

To avoid that we could instead walk the tree of Scorers, but then we need \{Scorable.getChildren}, which I guess is undesirable too. So there's a lesser-of-two-evils situation. Maybe having a mutable Query is not so bad?

> Add TrackingQuery to track matching documents
> ---------------------------------------------
>
>                 Key: LUCENE-9640
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9640
>             Project: Lucene - Core
>          Issue Type: New Feature
>          Components: core/search
>            Reporter: Elbek Kamoliddinov
>            Priority: Major
>              Labels: query
>
> Some users benefit having {{TrackingQuery}} functionality. This query would wrap another query and should be able to provide the matched DocIds for the wrapped query after search is run.  For example a user running a boolean query {{A or B}} could wrap query {{A}} into {{TrackingQuery}} and run the boolean query and check if documents that matched the boolean query matches the query {{A}}.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org