@Test public void testResultSize() throws IOException { addText(FIELD, "a1 a2 a3 a4 a5 a6 a7"); init(false); List<String> suggestions = getSuggestions(FIELD, "a", 2); assertEquals(2, suggestions.size()); }
public void init() throws IOException { lock.writeLock().lock(); try { long commitVersion = getCommitVersion(); if (hasStoredData() && commitVersion == getDataVersion()) { loadStoredWFSTs(); } else { createSuggesterDir(); build(); } if (allowMostPopular) { initSearchCountMap(); } storeDataVersion(commitVersion); } finally { lock.writeLock().unlock(); } }
SuggesterProjectData implements Closeable { public void init() throws IOException { lock.writeLock().lock(); try { long commitVersion = getCommitVersion(); if (hasStoredData() && commitVersion == getDataVersion()) { loadStoredWFSTs(); } else { createSuggesterDir(); build(); } if (allowMostPopular) { initSearchCountMap(); } storeDataVersion(commitVersion); } finally { lock.writeLock().unlock(); } } }
SuggesterProjectData implements Closeable { public void init() throws IOException { lock.writeLock().lock(); try { long commitVersion = getCommitVersion(); if (hasStoredData() && commitVersion == getDataVersion()) { loadStoredWFSTs(); } else { createSuggesterDir(); build(); } if (allowMostPopular) { initSearchCountMap(); } storeDataVersion(commitVersion); } finally { lock.writeLock().unlock(); } } SuggesterProjectData(
            final Directory indexDir,
            final Path suggesterDir,
            final boolean allowMostPopular,
            final Set<String> fields
    ); }
SuggesterProjectData implements Closeable { public void init() throws IOException { lock.writeLock().lock(); try { long commitVersion = getCommitVersion(); if (hasStoredData() && commitVersion == getDataVersion()) { loadStoredWFSTs(); } else { createSuggesterDir(); build(); } if (allowMostPopular) { initSearchCountMap(); } storeDataVersion(commitVersion); } finally { lock.writeLock().unlock(); } } SuggesterProjectData(
            final Directory indexDir,
            final Path suggesterDir,
            final boolean allowMostPopular,
            final Set<String> fields
    ); void init(); void rebuild(); List<Lookup.LookupResult> lookup(final String field, final String prefix, final int resultSize); void remove(); void incrementSearchCount(final Term term); boolean incrementSearchCount(final Term term, final int value); PopularityCounter getSearchCounts(final String field); @Override void close(); boolean tryLock(); void unlock(); List<Entry<BytesRef, Integer>> getSearchCountsSorted(final String field, int page, int pageSize); @Override String toString(); }
SuggesterProjectData implements Closeable { public void init() throws IOException { lock.writeLock().lock(); try { long commitVersion = getCommitVersion(); if (hasStoredData() && commitVersion == getDataVersion()) { loadStoredWFSTs(); } else { createSuggesterDir(); build(); } if (allowMostPopular) { initSearchCountMap(); } storeDataVersion(commitVersion); } finally { lock.writeLock().unlock(); } } SuggesterProjectData(
            final Directory indexDir,
            final Path suggesterDir,
            final boolean allowMostPopular,
            final Set<String> fields
    ); void init(); void rebuild(); List<Lookup.LookupResult> lookup(final String field, final String prefix, final int resultSize); void remove(); void incrementSearchCount(final Term term); boolean incrementSearchCount(final Term term, final int value); PopularityCounter getSearchCounts(final String field); @Override void close(); boolean tryLock(); void unlock(); List<Entry<BytesRef, Integer>> getSearchCountsSorted(final String field, int page, int pageSize); @Override String toString();  }