You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/03/09 19:52:51 UTC

[GitHub] [lucene] cpoerschke opened a new pull request #737: Reduce for-loop in WeightedSpanTermExtractor.extractWeightedSpanTerms method.

cpoerschke opened a new pull request #737:
URL: https://github.com/apache/lucene/pull/737


   Draft pull request only for today, no JIRA issue as yet, and not yet fully analysed things but from code reading it seems the query rewrite and term collecting need not happen in a loop?
   
   The https://github.com/apache/lucene/commit/81c7ba4601a9aaf16e2255fe493ee582abe72a90 change included
   
   ```
   - final SpanQuery rewrittenQuery = (SpanQuery) spanQuery.rewrite(getLeafContextForField(field).reader());
   + final SpanQuery rewrittenQuery = (SpanQuery) spanQuery.rewrite(getLeafContext().reader());
   ```
   
   as a change i.e. previously more needed to happen in the loop.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] jpountz commented on a change in pull request #737: LUCENE-10464: Reduce for-loop in WeightedSpanTermExtractor.extractWeightedSpanTerms method.

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #737:
URL: https://github.com/apache/lucene/pull/737#discussion_r831103798



##########
File path: lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
##########
@@ -309,11 +309,11 @@ protected void extractWeightedSpanTerms(
     final IndexSearcher searcher = new IndexSearcher(getLeafContext());
     searcher.setQueryCache(null);
     if (mustRewriteQuery) {
+      final SpanQuery rewrittenQuery = (SpanQuery) spanQuery.rewrite(getLeafContext().reader());

Review comment:
       Based on the discussion we had on LUCENE-10477, let's rewrite in a for-loop like Indexsearcher#rewrite does? https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.0.0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java#L665-L671




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] jpountz commented on a change in pull request #737: LUCENE-10464, LUCENE-10477: WeightedSpanTermExtractor.extractWeightedSpanTerms to rewrite sufficiently

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #737:
URL: https://github.com/apache/lucene/pull/737#discussion_r831971359



##########
File path: lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
##########
@@ -309,11 +309,12 @@ protected void extractWeightedSpanTerms(
     final IndexSearcher searcher = new IndexSearcher(getLeafContext());
     searcher.setQueryCache(null);
     if (mustRewriteQuery) {
+      final SpanQuery rewrittenQuery =
+          (SpanQuery) IndexSearcher.rewrite(spanQuery, getLeafContext().reader());

Review comment:
       +1




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] jpountz commented on pull request #737: Reduce for-loop in WeightedSpanTermExtractor.extractWeightedSpanTerms method.

Posted by GitBox <gi...@apache.org>.
jpountz commented on pull request #737:
URL: https://github.com/apache/lucene/pull/737#issuecomment-1066789801


   This change makes sense to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] cpoerschke commented on a change in pull request #737: LUCENE-10464: Reduce for-loop in WeightedSpanTermExtractor.extractWeightedSpanTerms method.

Posted by GitBox <gi...@apache.org>.
cpoerschke commented on a change in pull request #737:
URL: https://github.com/apache/lucene/pull/737#discussion_r831107050



##########
File path: lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
##########
@@ -309,11 +309,11 @@ protected void extractWeightedSpanTerms(
     final IndexSearcher searcher = new IndexSearcher(getLeafContext());
     searcher.setQueryCache(null);
     if (mustRewriteQuery) {
+      final SpanQuery rewrittenQuery = (SpanQuery) spanQuery.rewrite(getLeafContext().reader());

Review comment:
       Yeah, was just pondering the same and also looking if there's other code needing a similar change.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] cpoerschke merged pull request #737: LUCENE-10464, LUCENE-10477: WeightedSpanTermExtractor.extractWeightedSpanTerms to rewrite sufficiently

Posted by GitBox <gi...@apache.org>.
cpoerschke merged pull request #737:
URL: https://github.com/apache/lucene/pull/737


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] jpountz commented on a change in pull request #737: LUCENE-10464, LUCENE-10477: WeightedSpanTermExtractor.extractWeightedSpanTerms to rewrite sufficiently

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #737:
URL: https://github.com/apache/lucene/pull/737#discussion_r831152924



##########
File path: lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
##########
@@ -309,11 +309,12 @@ protected void extractWeightedSpanTerms(
     final IndexSearcher searcher = new IndexSearcher(getLeafContext());
     searcher.setQueryCache(null);
     if (mustRewriteQuery) {
+      final SpanQuery rewrittenQuery =
+          (SpanQuery) IndexSearcher.rewrite(spanQuery, getLeafContext().reader());

Review comment:
       or maybe we could do `new IndexSearcher(getLeafContext()).rewrite(spanQuery)` so that we wouldn't have to add a new API to IndexSearcher?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [lucene] cpoerschke commented on a change in pull request #737: LUCENE-10464, LUCENE-10477: WeightedSpanTermExtractor.extractWeightedSpanTerms to rewrite sufficiently

Posted by GitBox <gi...@apache.org>.
cpoerschke commented on a change in pull request #737:
URL: https://github.com/apache/lucene/pull/737#discussion_r831158244



##########
File path: lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
##########
@@ -309,11 +309,12 @@ protected void extractWeightedSpanTerms(
     final IndexSearcher searcher = new IndexSearcher(getLeafContext());
     searcher.setQueryCache(null);
     if (mustRewriteQuery) {
+      final SpanQuery rewrittenQuery =
+          (SpanQuery) IndexSearcher.rewrite(spanQuery, getLeafContext().reader());

Review comment:
       Actually `searcher` from line 309 would be suitable then too actually?!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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