Mailing List Archive

Determine the line number of a match
Hi there,

I just started playing around with lucene and I was wondering if there
is a simple method to determine the line number of a match within a =
file.
The documentation did not give me any hints on that...

Cheers,

Juergen

--
Dr. Jürgen Lind
iteratec GmbH Fon: +49 (0)89 614551-44
Inselkammerstrasse 4 Fax: +49 (0)89 614551-10
82008 Unterhaching Web: www.iteratec.de


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Determine the line number of a match [ In reply to ]
Jürgen,

>Hi there,
>
>I just started playing around with lucene and I was wondering if there
>is a simple method to determine the line number of a match within a =
>file.
>The documentation did not give me any hints on that...

You can use organize your index so that it stores a line as
a field of a Document. Then you only need to add a line number field
to each Document when you create the database.
In case you need to store multiple files you can also store the
file name in another field of the Document.

>Cheers,

Kampai,
Ype

P.S. On unix the grep program can give you the line number of the
match of a regular expression in a file.



--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: Determine the line number of a match [ In reply to ]
HI Juergen,

I believe the closest thing is the Term proximity information, but I
think that is relative token position, rather than the actually
offset from the original.

Winton

Winton Davies
Lead Engineer, Overture (NSDQ: OVER)
1820 Gateway Drive, Suite 360
San Mateo, CA 94404
work: (650) 403-2259
cell: (650) 867-1598
http://www.overture.com/

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>