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
protected boolean isCachable(PercolateQueryBuilder queryBuilder) {
protected boolean isCacheable(PercolateQueryBuilder queryBuilder) {
return false;
}

View File

@ -88,7 +88,7 @@ public class QueryShardContext extends QueryRewriteContext {
private final IndexReader reader;
private final String clusterAlias;
private String[] types = Strings.EMPTY_ARRAY;
private boolean cachable = true;
private boolean cacheable = true;
private final SetOnce<Boolean> frozen = new SetOnce<>();
private final Index fullyQualifiedIndex;
@ -333,7 +333,7 @@ public class QueryShardContext extends QueryRewriteContext {
* class says a request can be cached.
*/
protected final void failIfFrozen() {
this.cachable = false;
this.cacheable = false;
if (frozen.get() == Boolean.TRUE) {
throw new IllegalArgumentException("features that prevent cachability are disabled on this context");
} 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() {
return cachable;
public final boolean isCacheable() {
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
// 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 true;

View File

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

View File

@ -136,9 +136,9 @@ public class AllocateUnassignedDecisionTests extends ESTestCase {
}
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);
for (AllocationStatus allocationStatus : cachableStatuses) {
for (AllocationStatus allocationStatus : cacheableStatuses) {
if (allocationStatus == AllocationStatus.DECIDERS_THROTTLED) {
AllocateUnassignedDecision cached = AllocateUnassignedDecision.throttle(null);
AllocateUnassignedDecision another = AllocateUnassignedDecision.throttle(null);

View File

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

View File

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

View File

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

View File

@ -274,10 +274,10 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
}
@Override
protected boolean isCachable(TermsQueryBuilder queryBuilder) {
// even though we use a terms lookup here we do this during rewrite and that means we are cachable on toQuery
protected boolean isCacheable(TermsQueryBuilder queryBuilder) {
// 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
return super.isCachable(queryBuilder);
return super.isCacheable(queryBuilder);
}
public void testSerializationFailsUnlessFetched() throws IOException {

View File

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

View File

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

View File

@ -416,7 +416,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
public void testToQuery() throws IOException {
for (int runs = 0; runs < NUMBER_OF_TESTQUERIES; runs++) {
QueryShardContext context = createShardContext();
assert context.isCachable();
assert context.isCacheable();
context.setAllowUnmappedFields(true);
QB firstQuery = createTestQueryBuilder();
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*/
QueryBuilder rewritten = rewriteQuery(firstQuery, new QueryShardContext(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: "
+ firstQuery.toString(), context.isCachable());
+ firstQuery.toString(), context.isCacheable());
} else {
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);
assertLuceneQuery(firstQuery, firstLuceneQuery, searchContext);
@ -476,7 +476,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
return rewritten;
}
protected boolean isCachable(QB queryBuilder) {
protected boolean isCacheable(QB queryBuilder) {
return true;
}