Spelling: replace cachable with cacheable (#37047)

This commit is contained in:
Josh Soref 2019-01-02 08:10:30 -05:00 committed by Luca Cavanna
parent 8a02bacf76
commit d3e98278c3
12 changed files with 23 additions and 23 deletions

View File

@ -269,7 +269,7 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
} }
@Override @Override
protected boolean isCachable(PercolateQueryBuilder queryBuilder) { protected boolean isCacheable(PercolateQueryBuilder queryBuilder) {
return false; return false;
} }

View File

@ -88,7 +88,7 @@ public class QueryShardContext extends QueryRewriteContext {
private final IndexReader reader; private final IndexReader reader;
private final String clusterAlias; private final String clusterAlias;
private String[] types = Strings.EMPTY_ARRAY; private String[] types = Strings.EMPTY_ARRAY;
private boolean cachable = true; private boolean cacheable = true;
private final SetOnce<Boolean> frozen = new SetOnce<>(); private final SetOnce<Boolean> frozen = new SetOnce<>();
private final Index fullyQualifiedIndex; private final Index fullyQualifiedIndex;
@ -333,7 +333,7 @@ public class QueryShardContext extends QueryRewriteContext {
* class says a request can be cached. * class says a request can be cached.
*/ */
protected final void failIfFrozen() { protected final void failIfFrozen() {
this.cachable = false; this.cacheable = false;
if (frozen.get() == Boolean.TRUE) { if (frozen.get() == Boolean.TRUE) {
throw new IllegalArgumentException("features that prevent cachability are disabled on this context"); throw new IllegalArgumentException("features that prevent cachability are disabled on this context");
} else { } else {
@ -354,10 +354,10 @@ public class QueryShardContext extends QueryRewriteContext {
} }
/** /**
* Returns <code>true</code> iff the result of the processed search request is cachable. Otherwise <code>false</code> * Returns <code>true</code> iff the result of the processed search request is cacheable. Otherwise <code>false</code>
*/ */
public final boolean isCachable() { public final boolean isCacheable() {
return cachable; return cacheable;
} }
/** /**

View File

@ -1212,7 +1212,7 @@ public class IndicesService extends AbstractLifecycleComponent
// if now in millis is used (or in the future, a more generic "isDeterministic" flag // if now in millis is used (or in the future, a more generic "isDeterministic" flag
// then we can't cache based on "now" key within the search request, as it is not deterministic // then we can't cache based on "now" key within the search request, as it is not deterministic
if (context.getQueryShardContext().isCachable() == false) { if (context.getQueryShardContext().isCacheable() == false) {
return false; return false;
} }
return true; return true;

View File

@ -691,7 +691,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv
// during rewrite and normalized / evaluate templates etc. // during rewrite and normalized / evaluate templates etc.
QueryShardContext context = new QueryShardContext(searchContext.getQueryShardContext()); QueryShardContext context = new QueryShardContext(searchContext.getQueryShardContext());
Rewriteable.rewrite(request.getRewriteable(), context, assertAsyncActions); Rewriteable.rewrite(request.getRewriteable(), context, assertAsyncActions);
assert searchContext.getQueryShardContext().isCachable(); assert searchContext.getQueryShardContext().isCacheable();
success = true; success = true;
} finally { } finally {
if (success == false) { if (success == false) {

View File

@ -136,9 +136,9 @@ public class AllocateUnassignedDecisionTests extends ESTestCase {
} }
public void testCachedDecisions() { public void testCachedDecisions() {
List<AllocationStatus> cachableStatuses = Arrays.asList(AllocationStatus.DECIDERS_NO, AllocationStatus.DECIDERS_THROTTLED, List<AllocationStatus> cacheableStatuses = Arrays.asList(AllocationStatus.DECIDERS_NO, AllocationStatus.DECIDERS_THROTTLED,
AllocationStatus.NO_VALID_SHARD_COPY, AllocationStatus.FETCHING_SHARD_DATA, AllocationStatus.DELAYED_ALLOCATION); AllocationStatus.NO_VALID_SHARD_COPY, AllocationStatus.FETCHING_SHARD_DATA, AllocationStatus.DELAYED_ALLOCATION);
for (AllocationStatus allocationStatus : cachableStatuses) { for (AllocationStatus allocationStatus : cacheableStatuses) {
if (allocationStatus == AllocationStatus.DECIDERS_THROTTLED) { if (allocationStatus == AllocationStatus.DECIDERS_THROTTLED) {
AllocateUnassignedDecision cached = AllocateUnassignedDecision.throttle(null); AllocateUnassignedDecision cached = AllocateUnassignedDecision.throttle(null);
AllocateUnassignedDecision another = AllocateUnassignedDecision.throttle(null); AllocateUnassignedDecision another = AllocateUnassignedDecision.throttle(null);

View File

@ -334,7 +334,7 @@ public class MoreLikeThisQueryBuilderTests extends AbstractQueryTestCase<MoreLik
} }
@Override @Override
protected boolean isCachable(MoreLikeThisQueryBuilder queryBuilder) { protected boolean isCacheable(MoreLikeThisQueryBuilder queryBuilder) {
return queryBuilder.likeItems().length == 0; // items are always fetched return queryBuilder.likeItems().length == 0; // items are always fetched
} }

View File

@ -117,7 +117,7 @@ public class ScriptQueryBuilderTests extends AbstractQueryTestCase<ScriptQueryBu
} }
@Override @Override
protected boolean isCachable(ScriptQueryBuilder queryBuilder) { protected boolean isCacheable(ScriptQueryBuilder queryBuilder) {
return false; return false;
} }
} }

View File

@ -89,7 +89,7 @@ public class ScriptScoreQueryBuilderTests extends AbstractQueryTestCase<ScriptSc
} }
@Override @Override
protected boolean isCachable(ScriptScoreQueryBuilder queryBuilder) { protected boolean isCacheable(ScriptScoreQueryBuilder queryBuilder) {
return false; return false;
} }
} }

View File

@ -274,10 +274,10 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
} }
@Override @Override
protected boolean isCachable(TermsQueryBuilder queryBuilder) { protected boolean isCacheable(TermsQueryBuilder queryBuilder) {
// even though we use a terms lookup here we do this during rewrite and that means we are cachable on toQuery // even though we use a terms lookup here we do this during rewrite and that means we are cacheable on toQuery
// that's why we return true here all the time // that's why we return true here all the time
return super.isCachable(queryBuilder); return super.isCacheable(queryBuilder);
} }
public void testSerializationFailsUnlessFetched() throws IOException { public void testSerializationFailsUnlessFetched() throws IOException {

View File

@ -111,7 +111,7 @@ public class TermsSetQueryBuilderTests extends AbstractQueryTestCase<TermsSetQue
} }
@Override @Override
protected boolean isCachable(TermsSetQueryBuilder queryBuilder) { protected boolean isCacheable(TermsSetQueryBuilder queryBuilder) {
return queryBuilder.getMinimumShouldMatchField() != null || return queryBuilder.getMinimumShouldMatchField() != null ||
(queryBuilder.getMinimumShouldMatchScript() != null && queryBuilder.getValues().isEmpty()); (queryBuilder.getMinimumShouldMatchScript() != null && queryBuilder.getValues().isEmpty());
} }

View File

@ -797,7 +797,7 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
} }
@Override @Override
protected boolean isCachable(FunctionScoreQueryBuilder queryBuilder) { protected boolean isCacheable(FunctionScoreQueryBuilder queryBuilder) {
FilterFunctionBuilder[] filterFunctionBuilders = queryBuilder.filterFunctionBuilders(); FilterFunctionBuilder[] filterFunctionBuilders = queryBuilder.filterFunctionBuilders();
for (FilterFunctionBuilder builder : filterFunctionBuilders) { for (FilterFunctionBuilder builder : filterFunctionBuilders) {
if (builder.getScoreFunction() instanceof ScriptScoreFunctionBuilder) { if (builder.getScoreFunction() instanceof ScriptScoreFunctionBuilder) {

View File

@ -416,7 +416,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
public void testToQuery() throws IOException { public void testToQuery() throws IOException {
for (int runs = 0; runs < NUMBER_OF_TESTQUERIES; runs++) { for (int runs = 0; runs < NUMBER_OF_TESTQUERIES; runs++) {
QueryShardContext context = createShardContext(); QueryShardContext context = createShardContext();
assert context.isCachable(); assert context.isCacheable();
context.setAllowUnmappedFields(true); context.setAllowUnmappedFields(true);
QB firstQuery = createTestQueryBuilder(); QB firstQuery = createTestQueryBuilder();
QB controlQuery = copyQuery(firstQuery); QB controlQuery = copyQuery(firstQuery);
@ -426,12 +426,12 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
* we first rewrite the query with a private context, then reset the context and then build the actual lucene query*/ * we first rewrite the query with a private context, then reset the context and then build the actual lucene query*/
QueryBuilder rewritten = rewriteQuery(firstQuery, new QueryShardContext(context)); QueryBuilder rewritten = rewriteQuery(firstQuery, new QueryShardContext(context));
Query firstLuceneQuery = rewritten.toQuery(context); Query firstLuceneQuery = rewritten.toQuery(context);
if (isCachable(firstQuery)) { if (isCacheable(firstQuery)) {
assertTrue("query was marked as not cacheable in the context but this test indicates it should be cacheable: " assertTrue("query was marked as not cacheable in the context but this test indicates it should be cacheable: "
+ firstQuery.toString(), context.isCachable()); + firstQuery.toString(), context.isCacheable());
} else { } else {
assertFalse("query was marked as cacheable in the context but this test indicates it should not be cacheable: " assertFalse("query was marked as cacheable in the context but this test indicates it should not be cacheable: "
+ firstQuery.toString(), context.isCachable()); + firstQuery.toString(), context.isCacheable());
} }
assertNotNull("toQuery should not return null", firstLuceneQuery); assertNotNull("toQuery should not return null", firstLuceneQuery);
assertLuceneQuery(firstQuery, firstLuceneQuery, searchContext); assertLuceneQuery(firstQuery, firstLuceneQuery, searchContext);
@ -476,7 +476,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
return rewritten; return rewritten;
} }
protected boolean isCachable(QB queryBuilder) { protected boolean isCacheable(QB queryBuilder) {
return true; return true;
} }