Example usage for org.apache.lucene.facet.taxonomy TaxonomyReader openIfChanged

List of usage examples for org.apache.lucene.facet.taxonomy TaxonomyReader openIfChanged

Introduction

In this page you can find the example usage for org.apache.lucene.facet.taxonomy TaxonomyReader openIfChanged.

Prototype

public static <T extends TaxonomyReader> T openIfChanged(T oldTaxoReader) throws IOException 

Source Link

Document

If the taxonomy has changed since the provided reader was opened, open and return a new TaxonomyReader ; else, return null .

Usage

From source file:org.fao.geonet.kernel.search.index.TaxonomyIndexTracker.java

License:Open Source License

public void maybeRefresh() throws IOException {
    // do nothing for now
    if (taxonomyReader != null) {
        TaxonomyReader newReader = TaxonomyReader.openIfChanged(taxonomyReader);
        if (newReader != null) {
            if (taxonomyReader.getRefCount() == 0) {
                IOUtils.closeQuietly(taxonomyReader);
            } else {
                expiredReaders.add(taxonomyReader);
            }// w  ww .j  a v a 2  s .  c o  m
            taxonomyReader = newReader;
        }
    }
}