lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Lucene search returns Zip file Name
Date Sat, 06 Jan 2007 15:21:03 GMT
This is a confusing question. You have to create the index in the first
place. You can't just give the zip file to Lucene and expect it to do all
your work for you.

Somewhere, you have to have code like

Document doc = new Document();
doc.add(new Field("fieldname1", "stuff to store", Field.Store.***,
Field.Index.***));
doc.add(new Field("fieldname2", "more stuff to store", Field.Store.***,
Field.Index.***));
.
.
.
writer.add(doc);

the stuff you store in, say, fieldname1 is whatever you want. In this case,
say the real file name.
the stuff you store in, say, fieldname2 could be the zip file name.
the stuff you store in, say, fieldname3 could be the text of the file you
got from the zip file corresponding to fieldname1.

If this is conceptually unclear, I strongly recommend that you get a copy of
"Lucene in Action". It's has many examples of how to use lucene. Note that
it is written to the 1.4 code base, so there are some minor differences
between it and the latest 2.0 code.

Lucene isn't magic. It's an indexing and searching toolbox with an API that
you have to program with.

Best
Erick

On 1/5/07, Aslam Bari <iamaslamok@yahoo.co.in> wrote:
>
>
> Hi Erick,
> Thanks for reply,
> Can you tell me how to change indexer to store custom fields so that i can
> store two new fields like "Main File Name" and "Real File Name". so i can
> store Zip File name as Main file and Actual file where data found in Real
> File.
>
> Thanks...
>
>
> Erick Erickson wrote:
> >
> > You only get things out of an index that you put in there. At index
> time,
> > you need to associate file names with content. Something like indexing
> the
> > text of each file in the zip file as a separate lucene document, perhaps
> > with the associated zip file name and the real file name.
> >
> > Best
> > Erick
> >
> >
> > On 1/5/07, Aslam Bari <iamaslamok@yahoo.co.in> wrote:
> >>
> >>
> >> Dear all,
> >> I m using lucene to index zip files. Suppose a zip file contains 4
> files.
> >> All files get indexed well with uri of Zip file means when i search for
> >> any
> >> content the result comes and the resutl file name is zip file, but i
> need
> >> to
> >> know the real file name in which the data found. How to get that file
> >> name???
> >> Thanks....
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Lucene-search-returns-Zip-file-Name-tf2925197.html#a8176954
> >> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Lucene-search-returns-Zip-file-Name-tf2925197.html#a8190488
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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