jpountz commented on a change in pull request #940: LUCENE-9002: Query caching
leads to absurdly slow queries
URL: https://github.com/apache/lucene-solr/pull/940#discussion_r343917507
##########
File path: lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
##########
@@ -114,12 +115,20 @@
* Expert: Create a new instance that will cache at most <code>maxSize</code>
* queries with at most <code>maxRamBytesUsed</code> bytes of memory, only on
* leaves that satisfy {@code leavesToCache}.
+ *
+ * Also, clauses whose cost is {@code skipCacheFactor} times more than the
cost of the top-level query
+ * will not be cached in order to not slow down queries too much.
*/
public LRUQueryCache(int maxSize, long maxRamBytesUsed,
- Predicate<LeafReaderContext> leavesToCache) {
+ Predicate<LeafReaderContext> leavesToCache, float
skipCacheFactor) {
this.maxSize = maxSize;
this.maxRamBytesUsed = maxRamBytesUsed;
this.leavesToCache = leavesToCache;
+ if (skipCacheFactor < 1) {
Review comment:
```suggestion
if (skipCacheFactor >= 1 == false) { // NaN >= 1 evaluates true
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]