[GitHub] [lucene-solr] iverase commented on a change in pull request #1866: LUCENE-9523: Speed up query shapes for geometries that generate multiple points

2020-09-16 Thread GitBox


iverase commented on a change in pull request #1866:
URL: https://github.com/apache/lucene-solr/pull/1866#discussion_r489412779



##
File path: lucene/core/src/java/org/apache/lucene/document/ShapeQuery.java
##
@@ -265,10 +265,20 @@ private Scorer getSparseScorer(final LeafReader reader, 
final Weight weight, fin
 final DocIdSetIterator iterator = new BitSetIterator(result, cost[0]);
 return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
   }
-  final DocIdSetBuilder docIdSetBuilder = new 
DocIdSetBuilder(reader.maxDoc(), values, query.getField());
-  values.intersect(getSparseVisitor(query, docIdSetBuilder));
-  final DocIdSetIterator iterator = docIdSetBuilder.build().iterator();
-  return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
+  if (values.getDocCount() << 2 < values.size()) {
+// we use a dense structure so we can skip already visited documents
+final FixedBitSet result = new FixedBitSet(reader.maxDoc());

Review comment:
   Using a `SparseFixedBitSet` the gain is not so significant expect for 
complex queries:
   
   ```
   |point|intersects|0.00|0.00|-2%|347.46|356.09|-2%|2644|2644| 0%|
   |box|intersects|5.57|5.64|-1%|37.86|38.35|-1%|33081264|33081264| 0%|
   |distance|intersects|5.33|5.25| 2%|18.72|18.42| 2%|64062400|64062400| 0%|
   |poly 10|intersects|4.73|4.51| 5%|18.00|17.19| 5%|59064569|59064569| 0%|
   |polyMedium|intersects|0.43|0.34|24%|26.53|21.41|24%|528812|528812| 0%|
   |polyRussia|intersects|1.68|1.10|52%|6.87|4.51|52%|244848|244848| 0%|
   ```





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.

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



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



[GitHub] [lucene-solr] iverase commented on a change in pull request #1866: LUCENE-9523: Speed up query shapes for geometries that generate multiple points

2020-09-16 Thread GitBox


iverase commented on a change in pull request #1866:
URL: https://github.com/apache/lucene-solr/pull/1866#discussion_r489408392



##
File path: lucene/core/src/java/org/apache/lucene/document/ShapeQuery.java
##
@@ -265,10 +265,20 @@ private Scorer getSparseScorer(final LeafReader reader, 
final Weight weight, fin
 final DocIdSetIterator iterator = new BitSetIterator(result, cost[0]);
 return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
   }
-  final DocIdSetBuilder docIdSetBuilder = new 
DocIdSetBuilder(reader.maxDoc(), values, query.getField());
-  values.intersect(getSparseVisitor(query, docIdSetBuilder));
-  final DocIdSetIterator iterator = docIdSetBuilder.build().iterator();
-  return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
+  if (values.getDocCount() << 2 < values.size()) {
+// we use a dense structure so we can skip already visited documents
+final FixedBitSet result = new FixedBitSet(reader.maxDoc());
+final long[] cost = new long[]{reader.maxDoc()};

Review comment:
   Copy/paste error, it should be : 
   
   ```
   final long[] cost = new long[]{0};
   ```





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.

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



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



[GitHub] [lucene-solr] iverase commented on a change in pull request #1866: LUCENE-9523: Speed up query shapes for geometries that generate multiple points

2020-09-16 Thread GitBox


iverase commented on a change in pull request #1866:
URL: https://github.com/apache/lucene-solr/pull/1866#discussion_r489407818



##
File path: lucene/core/src/java/org/apache/lucene/document/ShapeQuery.java
##
@@ -265,10 +265,20 @@ private Scorer getSparseScorer(final LeafReader reader, 
final Weight weight, fin
 final DocIdSetIterator iterator = new BitSetIterator(result, cost[0]);
 return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
   }
-  final DocIdSetBuilder docIdSetBuilder = new 
DocIdSetBuilder(reader.maxDoc(), values, query.getField());
-  values.intersect(getSparseVisitor(query, docIdSetBuilder));
-  final DocIdSetIterator iterator = docIdSetBuilder.build().iterator();
-  return new ConstantScoreScorer(weight, boost, scoreMode, iterator);
+  if (values.getDocCount() << 2 < values.size()) {

Review comment:
   indeed that is safer





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.

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



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