You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lind Jürgen <Ju...@iteratec.de> on 2001/11/22 18:03:41 UTC

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


Re: Determine the line number of a match

Posted by Ype Kingma <yk...@xs4all.nl>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Determine the line number of a match

Posted by Winton Davies <wd...@overture.com>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>