You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by aneuryzma <pa...@gmail.com> on 2011/02/28 14:13:02 UTC

Can I use MatchAllDocsQuery and and specify terms to search in multiple fields of my documents ?

Can I use MatchAllDocsQuery and and specify terms to search in multiple
fields of my documents ?

I've seen that this query takes only 1 parameter: MatchAllDocsQuery(String
normsField), so I was wondering if I can search for multiple terms on
multiple fields.

thanks


-- 
View this message in context: http://lucene.472066.n3.nabble.com/Can-I-use-MatchAllDocsQuery-and-and-specify-terms-to-search-in-multiple-fields-of-my-documents-tp2594905p2594905.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: Can I use MatchAllDocsQuery and and specify terms to search in multiple fields of my documents ?

Posted by aneuryzma <pa...@gmail.com>.
yeah, I'm now using BooleanQuery indeed.

However I don't need just to get the top relevant document but all the
collection with relative scores.

This because I need to output a new file with document pairs and their
similarity values for all documents in the collection.

Also, the score won't be never 0 because I'm going to define my similarity
values for specific fields, such as numeric difference.. etc.

Hope it is clear... I was wondering if I can just set the second parameter
of the search method to the collection size.

searcher.search(booleanQuery, COLLETION_SIZE);

thanks


On 28 February 2011 15:43, Uwe Schindler [via Lucene] <
ml-node+2595427-982906096-365431@n3.nabble.com> wrote:

> A MatchAllDocsQuery simply matches all non-deleted documents exactly as the
>
> name suggests, so what are you trying to do? It makes no sense to add a
> restriction to this Query as it returns always everything. The parameter is
>
> only used for scoring to sort the documents according to the boost factor
> for the given field name.
>
> If you want to search for multiple terms in different Fields combine one or
>
> more TermQuery in a BooleanQuery.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2595427&i=0>
>
>
> > -----Original Message-----
> > From: aneuryzma [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=2595427&i=1>]
>
> > Sent: Monday, February 28, 2011 2:13 PM
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=2595427&i=2>
> > Subject: Can I use MatchAllDocsQuery and and specify terms to search in
> > multiple fields of my documents ?
> >
> > Can I use MatchAllDocsQuery and and specify terms to search in multiple
> > fields of my documents ?
> >
> > I've seen that this query takes only 1 parameter:
> MatchAllDocsQuery(String
> > normsField), so I was wondering if I can search for multiple terms on
> multiple
>
> > fields.
> >
> > thanks
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.nabble.com/Can-I-<http://lucene.472066.n3.nabble.com/Can-I-?by-user=t>
> > use-MatchAllDocsQuery-and-and-specify-terms-to-search-in-multiple-fields-
>
> > of-my-documents-tp2594905p2594905.html
> > Sent from the Lucene - General mailing list archive at Nabble.com.
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Can-I-use-MatchAllDocsQuery-and-and-specify-terms-to-search-in-multiple-fields-of-my-documents-tp2594905p2595427.html
>  To unsubscribe from Can I use MatchAllDocsQuery and and specify terms to
> search in multiple fields of my documents ?, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2594905&code=cGF0cmljay5kaXZpYWNjb0BnbWFpbC5jb218MjU5NDkwNXwyMDM1OTY2NTIx>.
>
>


-- 
View this message in context: http://lucene.472066.n3.nabble.com/Can-I-use-MatchAllDocsQuery-and-and-specify-terms-to-search-in-multiple-fields-of-my-documents-tp2594905p2595565.html
Sent from the Lucene - General mailing list archive at Nabble.com.

RE: Can I use MatchAllDocsQuery and and specify terms to search in multiple fields of my documents ?

Posted by Uwe Schindler <uw...@thetaphi.de>.
A MatchAllDocsQuery simply matches all non-deleted documents exactly as the
name suggests, so what are you trying to do? It makes no sense to add a
restriction to this Query as it returns always everything. The parameter is
only used for scoring to sort the documents according to the boost factor
for the given field name.

If you want to search for multiple terms in different Fields combine one or
more TermQuery in a BooleanQuery.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: aneuryzma [mailto:patrick.diviacco@gmail.com]
> Sent: Monday, February 28, 2011 2:13 PM
> To: general@lucene.apache.org
> Subject: Can I use MatchAllDocsQuery and and specify terms to search in
> multiple fields of my documents ?
> 
> Can I use MatchAllDocsQuery and and specify terms to search in multiple
> fields of my documents ?
> 
> I've seen that this query takes only 1 parameter: MatchAllDocsQuery(String
> normsField), so I was wondering if I can search for multiple terms on
multiple
> fields.
> 
> thanks
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Can-I-
> use-MatchAllDocsQuery-and-and-specify-terms-to-search-in-multiple-fields-
> of-my-documents-tp2594905p2594905.html
> Sent from the Lucene - General mailing list archive at Nabble.com.