You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Amrun <Am...@gmx.at> on 2004/04/05 11:36:49 UTC
how to combine queries?
Hi,
I'm new to lucene and I need to search for the content of several fields.
For example, I want to search for the given keywort in the content-field, in
the title-field, in a category-field and so on. How can I do this the best
way?
thanks for help
Amrûn
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: how to combine queries?
Posted by Andraz Skoric <an...@medius.si>.
Amrun wrote:
>Thanks for your answers,
>
>I've tried to use the MultiFieldQueryParser and it works quite good. But now
>I need to know how the operators like "+" or AND are working together?
>I have a searchmask at which you can choose e.g. the title, subject, class,
>categoriy, teacher and so on and I need to combine the given keywords.
>Say I want to get all the presentations from the class 5 from the teacher xy
>where the keywords are "security" "lucene" and so on.
>So I would combine the "presentations" with the "5" and teacher "xy" with
>PLUS and the keywords with " "? I don't really know how this operators work
>together.
>Hope someone can help me
>
Try to use MultiFiledQueryParser I posted yesterday... when I came to
the same problem as you I read that I sould create "virtual" field
keywords or smth like that, but it didn't fit into my app, 'couse I had
same values for different fields. So I created 2 new methods for mapping
one on one for fields and query strings for that fields... I use those
two methods in implementation of advanced search where user can search
onto multiple fields whit condition of finding all or finding anything.
It looks smth like that:
field1: query1
field2: query2
...
fieldN: queryN
If you need to find all, just use flags with value required and that
works for my case.
Andraz
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: how to combine queries?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Moving this thread to lucene-user list.
I'll assume you are working on a web application.
If so, you may want to look at
http://jakarta.apache.org/lucene/docs/lucene-sandbox/ and the
"Javascript Query Constructor" entry there.
Otis
--- Amrun <Am...@gmx.at> wrote:
> Thanks for your answers,
>
> I've tried to use the MultiFieldQueryParser and it works quite good.
> But now
> I need to know how the operators like "+" or AND are working
> together?
> I have a searchmask at which you can choose e.g. the title, subject,
> class,
> categoriy, teacher and so on and I need to combine the given
> keywords.
> Say I want to get all the presentations from the class 5 from the
> teacher xy
> where the keywords are "security" "lucene" and so on.
> So I would combine the "presentations" with the "5" and teacher "xy"
> with
> PLUS and the keywords with " "? I don't really know how this
> operators work
> together.
> Hope someone can help me
> thx
>
> > On Apr 5, 2004, at 5:36 AM, Amrun wrote:
> > > I'm new to lucene and I need to search for the content of several
>
> > > fields.
> > > For example, I want to search for the given keywort in the
> > > content-field, in
> > > the title-field, in a category-field and so on. How can I do this
> the
> > > best
> > > way?
> >
> > I just started a wiki page for this scenario:
> > http://wiki.apache.org/jakarta-lucene/SearchInMultipleFields
> >
> > Feel free to enhance it to cover more details.
> >
> > Erik
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> >
>
> --
> +++ NEU bei GMX und erstmalig in Deutschland: T�V-gepr�fter
> Virenschutz +++
> 100% Virenerkennung nach Wildlist. Infos:
> http://www.gmx.net/virenschutz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: how to combine queries?
Posted by Amrun <Am...@gmx.at>.
Thanks for your answers,
I've tried to use the MultiFieldQueryParser and it works quite good. But now
I need to know how the operators like "+" or AND are working together?
I have a searchmask at which you can choose e.g. the title, subject, class,
categoriy, teacher and so on and I need to combine the given keywords.
Say I want to get all the presentations from the class 5 from the teacher xy
where the keywords are "security" "lucene" and so on.
So I would combine the "presentations" with the "5" and teacher "xy" with
PLUS and the keywords with " "? I don't really know how this operators work
together.
Hope someone can help me
thx
> On Apr 5, 2004, at 5:36 AM, Amrun wrote:
> > I'm new to lucene and I need to search for the content of several
> > fields.
> > For example, I want to search for the given keywort in the
> > content-field, in
> > the title-field, in a category-field and so on. How can I do this the
> > best
> > way?
>
> I just started a wiki page for this scenario:
> http://wiki.apache.org/jakarta-lucene/SearchInMultipleFields
>
> Feel free to enhance it to cover more details.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: how to combine queries?
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 5, 2004, at 5:36 AM, Amrun wrote:
> I'm new to lucene and I need to search for the content of several
> fields.
> For example, I want to search for the given keywort in the
> content-field, in
> the title-field, in a category-field and so on. How can I do this the
> best
> way?
I just started a wiki page for this scenario:
http://wiki.apache.org/jakarta-lucene/SearchInMultipleFields
Feel free to enhance it to cover more details.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: how to combine queries?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Moving to lucene-user list.
You can use MultiFieldQueryParser if you want to parse queries entered
by people, or use BooleanQuery and its add methods if you want to
combine queries programmatically.
Otis
--- Amrun <Am...@gmx.at> wrote:
> Hi,
>
> I'm new to lucene and I need to search for the content of several
> fields.
> For example, I want to search for the given keywort in the
> content-field, in
> the title-field, in a category-field and so on. How can I do this the
> best
> way?
>
> thanks for help
> Amr�n
>
> --
> +++ NEU bei GMX und erstmalig in Deutschland: T�V-gepr�fter
> Virenschutz +++
> 100% Virenerkennung nach Wildlist. Infos:
> http://www.gmx.net/virenschutz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org