Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: General

Matching Search Terms?

 

 

Lucene general RSS feed   Index | Next | Previous | View Threaded


james at carmanconsulting

Jul 22, 2008, 7:53 AM

Post #1 of 3 (404 views)
Permalink
Matching Search Terms?

We have a requirement for our project where the user would like to be
able to paste a bunch of terms into a search box. They want to
basically "or" together each line of the pasted text as a full-text
search query. However, when the results come back, they'd like to
know which one of the lines matched the specific item returned. Is
there an easy way to do that with Lucene? I looked at the Hit API,
but nothing really jumped out at me. I would think that's where I
should look.


erik at ehatchersolutions

Jul 22, 2008, 7:59 AM

Post #2 of 3 (378 views)
Permalink
Re: Matching Search Terms? [In reply to]

On Jul 22, 2008, at 10:53 AM, James Carman wrote:
> We have a requirement for our project where the user would like to be
> able to paste a bunch of terms into a search box. They want to
> basically "or" together each line of the pasted text as a full-text
> search query. However, when the results come back, they'd like to
> know which one of the lines matched the specific item returned. Is
> there an easy way to do that with Lucene? I looked at the Hit API,
> but nothing really jumped out at me. I would think that's where I
> should look.

There are two options to consider... one is the Highlighter (one of
Java Lucene's contrib modules) and the other is converting the query
to a SpanQuery and walking the Spans from that API. The Highlighter
is the simplest approach to see if it suffices.

Erik


james at carmanconsulting

Jul 22, 2008, 8:07 AM

Post #3 of 3 (372 views)
Permalink
Re: Matching Search Terms? [In reply to]

Erik,

Thanks! Glad to see you on this project (we miss you on HiveMind)!
I'll try the Highlighter approach and see if that works. Are there
any examples out there?

James

On Tue, Jul 22, 2008 at 10:59 AM, Erik Hatcher
<erik[at]ehatchersolutions.com> wrote:
>
> On Jul 22, 2008, at 10:53 AM, James Carman wrote:
>>
>> We have a requirement for our project where the user would like to be
>> able to paste a bunch of terms into a search box. They want to
>> basically "or" together each line of the pasted text as a full-text
>> search query. However, when the results come back, they'd like to
>> know which one of the lines matched the specific item returned. Is
>> there an easy way to do that with Lucene? I looked at the Hit API,
>> but nothing really jumped out at me. I would think that's where I
>> should look.
>
> There are two options to consider... one is the Highlighter (one of Java
> Lucene's contrib modules) and the other is converting the query to a
> SpanQuery and walking the Spans from that API. The Highlighter is the
> simplest approach to see if it suffices.
>
> Erik
>
>

Lucene general RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.