mirror of https://github.com/apache/lucene.git
- 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:
parent
8a84cef92a
commit
021e328676
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue