Skip to content

Commit f3e1cd6

Browse files
committed
log the documents and their IDs
1 parent 7577736 commit f3e1cd6

File tree

1 file changed

+15
-10
lines changed
  • opengrok-indexer/src/main/java/org/opengrok/indexer/search

1 file changed

+15
-10
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2011, Jens Elkner.
2323
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2424
*/
@@ -44,7 +44,6 @@
4444
import org.apache.lucene.analysis.charfilter.HTMLStripCharFilter;
4545
import org.apache.lucene.document.DateTools;
4646
import org.apache.lucene.document.Document;
47-
import org.apache.lucene.index.CorruptIndexException;
4847
import org.apache.lucene.index.IndexableField;
4948
import org.apache.lucene.index.StoredFields;
5049
import org.apache.lucene.search.IndexSearcher;
@@ -76,22 +75,22 @@ private Results() {
7675
}
7776

7877
/**
79-
* Create a has map keyed by the directory of the document found.
78+
* Create a hash map keyed by the directory of the document found.
8079
*
8180
* @param searcher searcher to use.
8281
* @param hits hits produced by the given searcher's search
8382
* @param startIdx the index of the first hit to check
8483
* @param stopIdx the index of the last hit to check
85-
* @return a (directory, hitDocument) hashmap
86-
* @throws CorruptIndexException
87-
* @throws IOException
84+
* @return a (directory, list of hitDocument) hashmap
85+
* @throws IOException when index cannot be read
8886
*/
8987
private static Map<String, ArrayList<Integer>> createMap(
90-
IndexSearcher searcher, ScoreDoc[] hits, int startIdx, long stopIdx)
91-
throws CorruptIndexException, IOException {
88+
IndexSearcher searcher, ScoreDoc[] hits, int startIdx, long stopIdx) throws IOException {
9289

93-
LinkedHashMap<String, ArrayList<Integer>> dirHash =
94-
new LinkedHashMap<>();
90+
LOGGER.log(Level.FINEST, "directory hash contents for search hits ({0},{1}):",
91+
new Object[]{startIdx, stopIdx});
92+
93+
LinkedHashMap<String, ArrayList<Integer>> dirHash = new LinkedHashMap<>();
9594
StoredFields storedFields = searcher.storedFields();
9695
for (int i = startIdx; i < stopIdx; i++) {
9796
int docId = hits[i].doc;
@@ -102,10 +101,16 @@ private static Map<String, ArrayList<Integer>> createMap(
102101
continue;
103102
}
104103

104+
if (LOGGER.isLoggable(Level.FINEST)) {
105+
LOGGER.log(Level.FINEST, "{0}: {1}", new Object[]{docId, rpath});
106+
}
107+
105108
String parent = rpath.substring(0, rpath.lastIndexOf('/'));
106109
ArrayList<Integer> dirDocs = dirHash.computeIfAbsent(parent, k -> new ArrayList<>());
107110
dirDocs.add(docId);
108111
}
112+
113+
109114
return dirHash;
110115
}
111116

0 commit comments

Comments
 (0)