- Applied a patch submitted by Paul Spencer.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2002-01-01 00:26:14 +00:00
parent 8a84cef92a
commit 021e328676
1 changed files with 16 additions and 2 deletions

View File

@ -90,8 +90,22 @@ class SearchFiles {
final int HITS_PER_PAGE = 10; final int HITS_PER_PAGE = 10;
for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) { for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
int end = Math.min(hits.length(), start + HITS_PER_PAGE); int end = Math.min(hits.length(), start + HITS_PER_PAGE);
for (int i = start; i < end; i++) for (int i = start; i < end; i++) {
System.out.println(i + ". " + hits.doc(i).get("path")); Document doc = hits.doc(i);
String path = doc.get("path");
if (path != null) {
System.out.println(i + ". " + path);
} else {
String url = doc.get("url");
if (url != null) {
System.out.println(i + ". " + url);
System.out.println(" - " + doc.get("title"));
} else {
System.out.println(i + ". " + "No path nor URL for this document");
}
}
}
if (hits.length() > end) { if (hits.length() > end) {
System.out.print("more (y/n) ? "); System.out.print("more (y/n) ? ");
line = in.readLine(); line = in.readLine();