lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/demo/org/apache/lucene SearchFiles.java
Date Tue, 01 Jan 2002 00:26:14 GMT
otis        01/12/31 16:26:14

  Modified:    src/demo/org/apache/lucene SearchFiles.java
  Log:
  - Applied a patch submitted by Paul Spencer.
  
  Revision  Changes    Path
  1.3       +16 -2     jakarta-lucene/src/demo/org/apache/lucene/SearchFiles.java
  
  Index: SearchFiles.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/demo/org/apache/lucene/SearchFiles.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SearchFiles.java	18 Sep 2001 17:21:38 -0000	1.2
  +++ SearchFiles.java	1 Jan 2002 00:26:14 -0000	1.3
  @@ -90,8 +90,22 @@
   	final int HITS_PER_PAGE = 10;
   	for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
   	  int end = Math.min(hits.length(), start + HITS_PER_PAGE);
  -	  for (int i = start; i < end; i++)
  -	    System.out.println(i + ". " + hits.doc(i).get("path"));
  +	  for (int i = start; i < end; i++) {
  +	    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) {
   	    System.out.print("more (y/n) ? ");
   	    line = in.readLine();
  
  
  

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message