Can Lucene return search results with line number?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can Lucene return search results with line number?

gramcha
I want to implement "Find in Files" similar to one in IDE's using lucene. Basically wants to search in source code files like .c,.cpp,.h,.cs and .xml. I tried the demo shown in apache website. It returns the list of files without line numbers and number of occurance in that file. I am sure there should be some ways to get it.

Is there anyway to get those details?
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Can Lucene return search results with line number?

Hernan Lopes
for that you have many steps.. i bet lucy wont tell you the specific line
number. But it could tell you which documents contain that piece of code.
So you will need:
- Retrieve a list of files containing the text you are searching.
- Create a perl script that will iterate over each file on that returned
list. This script must tell you the line number where the text is found.
- Show the results to user


On Tue, Jun 25, 2013 at 2:30 AM, gramcha <[hidden email]> wrote:

> I want to implement "Find in Files" similar to one in IDE's using lucene.
> Basically wants to search in source code files like .c,.cpp,.h,.cs and
> .xml.
> I tried the demo shown in apache website. It returns the list of files
> without line numbers and number of occurance in that file. I am sure there
> should be some ways to get it.
>
> Is there anyway to get those details?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Can-Lucene-return-search-results-with-line-number-tp4072929.html
> Sent from the lucy-user mailing list archive at Nabble.com.
>