Example usage for org.apache.lucene.search IndexSearcher setDefaultQueryCachingPolicy

List of usage examples for org.apache.lucene.search IndexSearcher setDefaultQueryCachingPolicy

Introduction

In this page you can find the example usage for org.apache.lucene.search IndexSearcher setDefaultQueryCachingPolicy.

Prototype

public static void setDefaultQueryCachingPolicy(QueryCachingPolicy defaultQueryCachingPolicy) 

Source Link

Document

Expert: set the default QueryCachingPolicy instance.

Usage

From source file:org.hibernate.search.test.filter.deprecated.FilterTest.java

License:LGPL

@Override
@Before//w  ww .  ja  va  2  s . co  m
public void setUp() throws Exception {
    super.setUp();
    cachingPolicy = IndexSearcher.getDefaultQueryCachingPolicy();
    IndexSearcher.setDefaultQueryCachingPolicy(QueryCachingPolicy.ALWAYS_CACHE);
    createData();
    query = createQuery();
    fullTextSession = Search.getFullTextSession(openSession());
    fullTextSession.getTransaction().begin();
}

From source file:org.hibernate.search.test.filter.deprecated.FilterTest.java

License:LGPL

@Override
@After//from  ww w  . j a v a  2 s.  c  o  m
public void tearDown() throws Exception {
    try {
        fullTextSession.getTransaction().commit();
        fullTextSession.close();
    } finally {
        // Reset the caching policy to its original state
        if (cachingPolicy != null) {
            IndexSearcher.setDefaultQueryCachingPolicy(cachingPolicy);
        }
    }
    super.tearDown();
}