Skip to content

Commit

Permalink
findRunIndex added
Browse files Browse the repository at this point in the history
  • Loading branch information
hmarkc committed Aug 30, 2021
1 parent f5f422e commit 99ed7a4
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,23 @@ public Query getRunQuery(Run<?, ?> run) throws ParseException {
return builder.build();
}

@Override
public boolean findRunIndex(Run<?, ?> run) {
try {
Query query = getRunQuery(run);
IndexReader reader = DirectoryReader.open(index);
IndexSearcher searcher = new IndexSearcher(reader);
TopDocs docs = searcher.search(query, 1);
reader.close();
return docs.scoreDocs.length > 0;
} catch (ParseException e) {
LOGGER.warn("findRunIndex: " + e);
} catch (IOException e) {
LOGGER.warn("findRunIndex: " + e);
}
return false;
}

@Override
public void removeBuild(Run<?, ?> run) throws IOException {
try {
Expand Down

0 comments on commit 99ed7a4

Please sign in to comment.