List of usage examples for org.apache.lucene.search QueryCachingPolicy shouldCache
boolean shouldCache(Query query) throws IOException;
From source file:org.elasticsearch.index.shard.ElasticsearchQueryCachingPolicyTests.java
License:Apache License
public void testDoesNotCacheTermQueries() throws IOException { QueryCachingPolicy policy = QueryCachingPolicy.ALWAYS_CACHE; assertTrue(policy.shouldCache(new TermQuery(new Term("foo", "bar")))); assertTrue(policy.shouldCache(new PhraseQuery("foo", "bar", "baz"))); policy = new ElasticsearchQueryCachingPolicy(policy); assertFalse(policy.shouldCache(new TermQuery(new Term("foo", "bar")))); assertTrue(policy.shouldCache(new PhraseQuery("foo", "bar", "baz"))); }