-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce constants for trivial QueryCachingPolicies (#86344)
Just a random find: Cleaning this up, mainly to simplify the already far too complex `IndexShard` constructor.
- Loading branch information
1 parent
75ae3f8
commit e4df5fd
Showing
7 changed files
with
47 additions
and
93 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
server/src/main/java/org/elasticsearch/index/cache/query/TrivialQueryCachingPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
package org.elasticsearch.index.cache.query; | ||
|
||
import org.apache.lucene.search.Query; | ||
import org.apache.lucene.search.QueryCachingPolicy; | ||
|
||
public enum TrivialQueryCachingPolicy implements QueryCachingPolicy { | ||
ALWAYS(true), | ||
NEVER(false); | ||
|
||
private final boolean shouldCache; | ||
|
||
TrivialQueryCachingPolicy(boolean shouldCache) { | ||
this.shouldCache = shouldCache; | ||
} | ||
|
||
@Override | ||
public void onUse(Query query) {} | ||
|
||
@Override | ||
public boolean shouldCache(Query query) { | ||
return shouldCache; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters