lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "yueyu lin" <popeye...@gmail.com>
Subject Re: Problem : Searching with Lucene 2.0
Date Thu, 06 Jul 2006 06:56:51 GMT
I didn't see the demo codes. You should look into the
indexDocs(IndexWriter,File) function  to see if it stores these kinds of
contents.

On 7/6/06, Sarvadnya Mutalik <sarvadnya.mutalik@renaissance-it.com> wrote:
>
> I'm using the indexing technique as illustrated in the example provided
> by Lucene 2.0. (as in demo ==> IndexFiles.java)
> The Indexing the method  is as bellow....
>
>
>   static void indexDocs(IndexWriter writer, File file) throws
> IOException {
>
>     // do not try to index files that cannot be read
>     if (file.canRead()) {
>       if (file.isDirectory()) {
>         String[] files = file.list();
>         // an IO error could occur
>         if (files != null) {
>           for (int i = 0; i < files.length; i++) {
>             indexDocs(writer, new File(file, files[i]));  //Recursive
> call (calling the same method)
>           }
>         }
>       }
>
>       else {
>         System.out.println("adding " + file);
>         try {
>           writer.addDocument(FileDocument.Document(file)); //writer is
> the object of
>         }
>         // at least on windows, some temporary files raise this
> exception with an "access denied" message
>         // checking if the file can be read doesn't help
>         catch (FileNotFoundException fnfe) {
>         //To be filled
>         }
>       }
>     }
>   }
>
> Need your help..
>
> Regards
> Sam
>
> -----Original Message-----
> From: yueyu lin [mailto:popeyelin@gmail.com]
> Sent: Thursday, July 06, 2006 11:39 AM
> To: java-user@lucene.apache.org
> Subject: Re: Problem : Searching with Lucene 2.0
>
> How you index "doctitle" and "summary".
> The Store parameter must be "COMPRESS" or "YES"
>
> On 7/6/06, Sarvadnya Mutalik <sarvadnya.mutalik@renaissance-it.com>
> wrote:
> >
> > Hi, I'm using Lucene 2.0, latest ver of Apache Lucene search engine.
> > After successfully indexing, when I tried to search, I'm not able to
> > get the complete information.
> > In the following code snippet, I'm getting the values for  "doctitle"
> > and "summary" as null.
> > While it says there are two results.
> >
> >
> >         for (int i = startindex; i < (thispage + startindex); i++) {
> > // for each element
> >
> >                         Document doc = hits.doc(i); //get the next
> > document
> >                         String doctitle = doc.get("title"); //get its
> > title
> >                         String url = doc.get("path"); //get its url
> > field
> >
> >                         if ((doctitle == null) || doctitle.equals(""))
>
> > //use the url if it has no title
> >                                 doctitle = url;
> >
> >
> >                 String summary = doc.get("summary");
> >
> >                 ......
> >                 ......
> >         }
> >
> > Please help..
> >
> > Regards,
> > Sam
> >
> > =========================================
> > The information transmitted is intended only for the person or entity
> > to which it is addressed and may contain confidential and/or
> > privileged material. Any review, retransmission, dissemination or
> > other use of, or taking of any action in reliance upon, this
> > information by persons or entities other than the intended recipient
> > is prohibited. If you received this in error, please contact the
> > sender and delete all copies from any computer.
> >
> >
> >
> >
> >
>
>
> --
> --
> Yueyu Lin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
--
Yueyu Lin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message