Oh!  Thank you very much.  

Brittany Jacobs
Java Developer
JBManagement, Inc.
12 Christopher Way, Suite 103
Eatontown, NJ 07724
ph: 732-542-9200 ext. 229
fax: 732-380-0678
email: [EMAIL PROTECTED]

-----Original Message-----
From: Ian Lea [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 10:23 AM
To: java-user@lucene.apache.org
Subject: Re: LineDocMaker usage

In the example code 2 separate fields are being added to each
document, the file name and the contents of one line.  The fields can
be queried or retrieved separately. There is a typo in the second
Field line: should read "line" or whatever you wanted the field to be
called.

But as Anshum says, what you actually tokenize/index/store is up to you.


--
Ian.



On Fri, Aug 8, 2008 at 2:50 PM, Brittany Jacobs
<[EMAIL PROTECTED]> wrote:
> Why do you add to the doc twice, once with the file path and once with the
> string?
>
> -Brittany
>
> -----Original Message-----
> From: Anshum [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2008 10:30 PM
> To: java-user@lucene.apache.org
> Subject: Re: LineDocMaker usage
>
> Hi,
> How about just opening a file and parsing through it while adding doing a
> doc.add on each newline? That should be pretty straight and simple.
> Just writing the snippet here, though this might have issues as didnt try
to
> compile it.
>
>    IndexWriter writer = new IndexWriter(indexDir, new StandardAnalyzer(),
> true);
>
>    FileInputStream fstream = new FileInputStream("textfile.txt");
>    DataInputStream in = new DataInputStream(fstream);
>    BufferedReader br = new BufferedReader(new InputStreamReader(in));
>    String strLine;
>    while ((strLine = br.readLine()) != null)   {
>        Document doc = new Document();
>            doc.add(new Field("filename",
> f.getCanonicalPath(),Field.Store.YES,Field.Index.TOKENIZED));
>            doc.add(new Field("filename",
> strLine,Field.Store.YES,Field.Index.TOKENIZED));//DEPENDING UPON HOW YOU
> WANT TO INDEX IT
>            writer.addDocument(doc);
>    }
>    in.close();
>    writer.close();
>
>
> Also, I have tokenized the content and stored it so that it could be
> fetched, you might just want to have a ref key instead of storing the
> entrire content though. Upto you for implementation.
>
> --
> Anshum
> http://ai-cafe.blogspot.com
>
>
>
> On Thu, Aug 7, 2008 at 1:42 AM, Brittany Jacobs
> <[EMAIL PROTECTED]>wrote:
>
>> Hello, I am new to all this.  I need to read in a text file and have each
>> line in the file be a document.
>>
>> The LineDocMaker seems to be intended for this purpose.  But I can't
> figure
>> out how to read the data into it.
>>
>> Any examples would be greatly appreciated.
>>
>>
>>
>>
>
>
> --
> --
> The facts expressed here belong to everybody, the opinions to me.
> The distinction is yours to draw............
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to