Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -893,21 +893,27 @@ private static boolean isStrictlyNewerThanDocument(File file) {
try {
Document doc = IndexDatabase.getDocument(file);
if (Objects.isNull(doc)) {
LOGGER.log(Level.WARNING, "cannot get document for ''{0}''", file);
return true;
}
IndexableField field = doc.getField(QueryBuilder.DATE);
try {
Date docDate = DateTools.stringToDate(field.stringValue());
// Assumes millisecond precision.
long lastModified = file.lastModified();
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINEST, String.format("checking date for '%s': %d %d",
file, lastModified, docDate.getTime()));
}
if (lastModified <= docDate.getTime()) {
return false;
}
} catch (java.text.ParseException e) {
LOGGER.log(Level.WARNING, String.format("cannot convert date for '%s'", file), e);
return true;
}
} catch (ParseException | IOException e) {
LOGGER.log(Level.FINEST, "cannot get document for ''{0}''", file);
LOGGER.log(Level.WARNING, String.format("cannot get document for '%s'", file), e);
}

return true;
Expand Down Expand Up @@ -2105,7 +2111,8 @@ public static Document getDocument(File file) throws ParseException, IOException
try {
Statistics stat = new Statistics();
TopDocs top = searcher.search(q, 1);
stat.report(LOGGER, Level.FINEST, String.format("search via getDocument(%s) done", file),
stat.report(LOGGER, Level.FINEST,
String.format("search via getDocument(%s) done (%d hits)", file, top.totalHits.value),
"search.latency", new String[]{"category", "getdocument",
"outcome", top.totalHits.value == 0 ? "empty" : "success"});
if (top.totalHits.value == 0) {
Expand All @@ -2117,6 +2124,8 @@ public static Document getDocument(File file) throws ParseException, IOException

// Only use the document if we found an exact match.
if (!path.equals(foundPath)) {
LOGGER.log(Level.FINEST, "not matching path: ''{0}'' for ''{1}''",
new Object[]{foundPath, path});
return null;
}
} finally {
Expand Down
Loading