Solr, which is built on top of lucene and adds highlighting among other
features, gets close to what you want. Check out:
http://wiki.apache.org/solr/HighlightingParameters
- will
-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com]
Sent: Friday, June 01, 2007 8:57 AM
To: java-user@lucene.apache.org
Subject: Re: question about lucene
Nope. But here's what I think you can do (although I haven't
tried this exactly, so caveat emptor).
Document doc = new Document();
doc.add("text", line1);
doc.add("text", line2);
doc.add("text", line3);
writer.add(doc);
Now, when searching, you can get the document back and
String[] lines = doc.getValues();
At this point, lines[0] contains line1, lines[1] contains line2, etc.
Perhaps something with Highlighter would work here, or you can
use a MemoryIndex to manipulate them....
But you have some issues here. What is the "correct" line to display if
you search on, say, "Erick AND Tanya" and "Erick" is on one line but
"Tanya" is on another?
Perhaps it would help if you posted a statement of the actual problem
you're trying to solve, there may be other, easier approaches.....
Erick
On 6/1/07, Tanya Levshina <tanya@volvovski.com> wrote:
>
> Wow, it was fast! Thanks. Do you know about any existing application
that
> is
> built on top of lucene that provides this functionality?
>
> Tanya
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Friday, June 01, 2007 7:18 AM
> To: java-user@lucene.apache.org
> Subject: Re: question about lucene
>
> No. Lucene is an *engine*, not an app that has a lot of stuff built on
top
> of it out of the box.
>
> You have to index enough information to figure this out somehow.
>
> Best
> Erick
>
> On 6/1/07, Tanya Levshina <tanya@volvovski.com> wrote:
> >
> > Hi,
> >
> >
> >
> > I've just downloaded Lucene, tried demo and looked at the
documentation.
> > The
> > Indexing and Searching work great and fast but I also need to
display
> all
> > the actual "hits": the lines from the files that match a particular
> > query.
> > Does Lucene provide means to do it?
> >
> >
> >
> > Thanks a lot,
> >
> >
> >
> > Tanya
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|