[ https://issues.apache.org/jira/browse/LUCENE-9640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17303720#comment-17303720 ]
Uwe Schindler commented on LUCENE-9640: --------------------------------------- Elasticsearch has this functionality using the named query. When building the query tree you tag all "interesting queries" with a name and for each hit you get back all tag names the result was a hit. See docs: https://www.elastic.co/guide/en/elasticsearch/reference/7.11/query-dsl-bool-query.html#named-queries They implement this outside and without wrapping: https://github.com/elastic/elasticsearch/blob/a92a647b9f17d1bddf5c707490a19482c273eda3/server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesPhase.java The idea is to create a separate weight for each tagged query somewhere in the tree. For each hit, you just check by advancing the scorer of each tagged query to check if it's a hit. This is completely outside and works quite well. I have used it quite often in Elasticsearch. > 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-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org