Thanks... that's what I thought of ... but was wondering if that was the
best method to do so... i guess it is then... :)




On Wed, May 7, 2008 at 12:32 AM, Erick Erickson <[EMAIL PROTECTED]>
wrote:

> One of my favorite quotes from Roger Zelazny... "postulating
> infinity, the rest is easy".
>
> In this case, "infinity" is how you break up your query. The easy part is
> making your search return what you want.
>
> Assuming you know that you want "greatest" and
> "hits" to go against the title field and "beatles" to
> go against description, your query looks something
> like:
>
> +title:greatest +title:hits +description:beatles
>
> But knowing you want to break up the query like that is the hard part.
>
> Sometimes you can make it work well enough by submitting all
> terms against both fields with an OR clause, something like:
>
> title:(+greatest +hits +beatles) description:(+greatest +hits +beatles)
> (note, OR is implied between title and description)
>
> which would not work in your case. Another technique is to dump
> all the words into a single uber-field *as well as* your individual
> fields, so the search
> uber:(+greatest +hits +beatles) would work for you. Note that if
> you index (but do NOT store) the uber field and store (but do NOT index)
> the text and description fields, your index stays about the same size.....
>
> Anyway, you need to carefully define how your searches *should* work,
> then define your index structure IMO.
>
> Best
> Erick
>
> On Tue, May 6, 2008 at 12:07 PM, Kelvin Foo Chuan Lyi <[EMAIL PROTECTED]>
> wrote:
>
> > I'm new to lucene and have a question on how to create a query for the
> > following example... Say I have two fields, Title and Description, with
> > the
> > following data
> >
> > Item 1
> > Title: The greatest hits
> > Description : Collection of the best music from The Beatles.
> >
> > Item 2
> > Title: U2 collections
> > Description : Greatest hits collection of U2
> >
> >
> > In my search, I want to search for 'greatest hits beatles'. The result
> > should return only Item 1..  how should the query looks like??
> >
> >
> > Thanks.
> >
> >
> >
> >
> > --
> > Sayonara,
> > Kelvin
> >
>



-- 
Sayonara,
Kelvin

Reply via email to