lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Spencer <pau...@apache.org>
Subject [PATCH] Add URL and Title to SearchFiles.Java
Date Sun, 09 Dec 2001 10:13:24 GMT
The patch below will display the URL and Title for documents added with 
IndexHTML.  Currently "null" is displayed as the file name.

Paul Spencer

Index: SearchFiles.java
===================================================================
RCS file: 
/home/cvs/jakarta-lucene/src/demo/org/apache/lucene/SearchFiles.java,v
retrieving revision 1.2
diff -c -r1.2 SearchFiles.java
*** SearchFiles.java	2001/09/18 17:21:38	1.2
--- SearchFiles.java	2001/12/09 09:41:30
***************
*** 91,97 ****
   	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"));
   	  if (hits.length() > end) {
   	    System.out.print("more (y/n) ? ");
   	    line = in.readLine();
--- 91,106 ----
   	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++)
!             if (hits.doc(i).get("path") != null) {
! 	      System.out.println(i + ". " + hits.doc(i).get("path"));
!             } else {
!               if (hits.doc(i).get("url") != null) {
! 	        System.out.println(i + ". " + hits.doc(i).get("url"));
! 	        System.out.println("   - " + hits.doc(i).get("title"));
!               } else {
! 	        System.out.println(i + ". " + "No Path or URL to 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