@Test @SuppressWarnings("unchecked") public void testIncreaseSearchCount() throws IOException { SuggesterTestData t = initSuggester(); t.s.increaseSearchCount("test", new Term("test", "term2"), 100, true); List<Entry<BytesRef, Integer>> res = t.s.getSearchCounts("test", "test", 0, 10); assertThat(res, contains(new SimpleEntry<>(new BytesRef("term2"), 100))); t.close(); }
public boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock) { if (!allowMostPopular) { return false; } SuggesterProjectData data; if (!projectsEnabled) { data = projectData.get(PROJECTS_DISABLED_KEY); } else { data = projectData.get(project); } if (data == null) { logger.log(Level.WARNING, "Cannot update search count because of missing suggester data{}", projectsEnabled ? " for project " + project : ""); return false; } return data.incrementSearchCount(term, value, waitForLock); }
Suggester implements Closeable { public boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock) { if (!allowMostPopular) { return false; } SuggesterProjectData data; if (!projectsEnabled) { data = projectData.get(PROJECTS_DISABLED_KEY); } else { data = projectData.get(project); } if (data == null) { logger.log(Level.WARNING, "Cannot update search count because of missing suggester data{}", projectsEnabled ? " for project " + project : ""); return false; } return data.incrementSearchCount(term, value, waitForLock); } }
Suggester implements Closeable { public boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock) { if (!allowMostPopular) { return false; } SuggesterProjectData data; if (!projectsEnabled) { data = projectData.get(PROJECTS_DISABLED_KEY); } else { data = projectData.get(project); } if (data == null) { logger.log(Level.WARNING, "Cannot update search count because of missing suggester data{}", projectsEnabled ? " for project " + project : ""); return false; } return data.incrementSearchCount(term, value, waitForLock); } Suggester(
            final File suggesterDir,
            final int resultSize,
            final Duration awaitTerminationTime,
            final boolean allowMostPopular,
            final boolean projectsEnabled,
            final Set<String> allowedFields,
            final int timeThreshold,
            final int rebuildParallelismLevel,
            MeterRegistry registry); }
Suggester implements Closeable { public boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock) { if (!allowMostPopular) { return false; } SuggesterProjectData data; if (!projectsEnabled) { data = projectData.get(PROJECTS_DISABLED_KEY); } else { data = projectData.get(project); } if (data == null) { logger.log(Level.WARNING, "Cannot update search count because of missing suggester data{}", projectsEnabled ? " for project " + project : ""); return false; } return data.incrementSearchCount(term, value, waitForLock); } Suggester(
            final File suggesterDir,
            final int resultSize,
            final Duration awaitTerminationTime,
            final boolean allowMostPopular,
            final boolean projectsEnabled,
            final Set<String> allowedFields,
            final int timeThreshold,
            final int rebuildParallelismLevel,
            MeterRegistry registry); void init(final Collection<NamedIndexDir> luceneIndexes); void waitForInit(long timeout, TimeUnit unit); void rebuild(final Collection<NamedIndexDir> indexDirs); void waitForRebuild(long timeout, TimeUnit unit); void remove(final Iterable<String> names); Suggestions search(
            final List<NamedIndexReader> indexReaders,
            final SuggesterQuery suggesterQuery,
            final Query query
    ); void onSearch(final Iterable<String> projects, final Query query); void setResultSize(final int resultSize); void setAwaitTerminationTime(final Duration awaitTerminationTime); boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock); List<Entry<BytesRef, Integer>> getSearchCounts(
            final String project,
            final String field,
            final int page,
            final int pageSize
    ); @Override void close(); }
Suggester implements Closeable { public boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock) { if (!allowMostPopular) { return false; } SuggesterProjectData data; if (!projectsEnabled) { data = projectData.get(PROJECTS_DISABLED_KEY); } else { data = projectData.get(project); } if (data == null) { logger.log(Level.WARNING, "Cannot update search count because of missing suggester data{}", projectsEnabled ? " for project " + project : ""); return false; } return data.incrementSearchCount(term, value, waitForLock); } Suggester(
            final File suggesterDir,
            final int resultSize,
            final Duration awaitTerminationTime,
            final boolean allowMostPopular,
            final boolean projectsEnabled,
            final Set<String> allowedFields,
            final int timeThreshold,
            final int rebuildParallelismLevel,
            MeterRegistry registry); void init(final Collection<NamedIndexDir> luceneIndexes); void waitForInit(long timeout, TimeUnit unit); void rebuild(final Collection<NamedIndexDir> indexDirs); void waitForRebuild(long timeout, TimeUnit unit); void remove(final Iterable<String> names); Suggestions search(
            final List<NamedIndexReader> indexReaders,
            final SuggesterQuery suggesterQuery,
            final Query query
    ); void onSearch(final Iterable<String> projects, final Query query); void setResultSize(final int resultSize); void setAwaitTerminationTime(final Duration awaitTerminationTime); boolean increaseSearchCount(final String project, final Term term, final int value, final boolean waitForLock); List<Entry<BytesRef, Integer>> getSearchCounts(
            final String project,
            final String field,
            final int page,
            final int pageSize
    ); @Override void close();  }