You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Paul Spencer <pa...@apache.org> on 2001/12/09 11:13:24 UTC

[PATCH] Add URL and Title to SearchFiles.Java

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Suggestion: apply java code convention with astyle in lucene source?

Posted by Che Dong <ch...@yahoo.com>.
Hi All:
I don't know if you have trouble with reading lucene source which mostly
have only one space indent.
Is it possible apply sun java code convention in lucene source code?
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

Sometime I use astyle reformat the lucene source before reading.
http://sourceforge.net/projects/astyle
Its only a little bit confuse with javacc *.jj files. It will occur a error
with "could not rename *.jj to *.jj.orig" when reformat .jj directly. You
need to rename it *.jj to *.jj.java, astyle it and rename it back to .jj.

I think it might be more efficiently communication with others if all lucene
source reformatted according to java code conventions.


Regards

Che Dong


astyle:
Download: http://prdownloads.sourceforge.net/astyle/astyle_1.14.1_build2.zip
unzip and just 'make' in astyle dir, This should create an executable file
called 'astyle'.
useage: astyle --style=java *.java



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Suggestion: xml, make a more common standard interface outside lucene

Posted by Che Dong <ch...@yahoo.com>.
Hi all:
I use lucene several monthes and think maybe make a standard Xml interface
(Bind to Document and Field) outside Lucene(Document, Field, Query...) will
make system more felexable for users intergrating lucene with their
applactions.

Indexing:
any_source(file,html,database)
    ==(parser converter...)==>
source.xml
    ==(XmlIndexer(Url, outputDir))==>
lucene index

Searching and output:
query.xml
    ==(XmlToQuery)==>
lucene searcher
    ==(hitToXml)==>
output.xml

Che, Dong


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] Add URL and Title to SearchFiles.Java

Posted by Otis Gospodnetic <ot...@yahoo.com>.
It's been applied.

Thanks for the patch.

Otis

--- Paul Spencer <pa...@apache.org> wrote:
> What is the status of this patch?  I believe I makes for a better
> demo 
> application since it will display a valid URL instead of "null"
> 
> Paul Spencer
> 
> Paul Spencer wrote:
> 
> > 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:   
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail: 
> > <ma...@jakarta.apache.org>
> > 
> > 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] Add URL and Title to SearchFiles.Java

Posted by Paul Spencer <pa...@apache.org>.
What is the status of this patch?  I believe I makes for a better demo 
application since it will display a valid URL instead of "null"

Paul Spencer

Paul Spencer wrote:

> 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:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>