You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mindaugas Žakšauskas <mi...@gmail.com> on 2010/05/10 15:30:50 UTC

MatchAllDocsQuery and MatchNoDocsQuery

Hi,

Can anybody confirm whether MatchAllDocsQuery can be used as an
immutable singletone? By this I mean creating a single instance and
sharing it whenever I need to either use it on its own or in
cojunction with other queries put into a BooleanQuery; to result all
documents in a search result. Can the same instance even be reused
among different threads?

What would be the best way implementing MatchNoDocsQuery? My initial
tests show that a new BooleanQuery() without any additional clauses
would just do the job, but I just wanted to double check whether this
is be a reliable assumption. Above questions also apply - could this
be reused among different contexts, threads?

Thanks in advance.

Regards,
Mindaugas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: MatchAllDocsQuery and MatchNoDocsQuery

Posted by Yonik Seeley <yo...@lucidimagination.com>.
Yes on all counts.  Lucene doesn't modify query objects, so they are
save for reuse among multiple threads.

-Yonik
Apache Lucene Eurocon 2010
18-21 May 2010 | Prague



2010/5/10 Mindaugas Žakšauskas <mi...@gmail.com>:
> Hi,
>
> Can anybody confirm whether MatchAllDocsQuery can be used as an
> immutable singletone? By this I mean creating a single instance and
> sharing it whenever I need to either use it on its own or in
> cojunction with other queries put into a BooleanQuery; to result all
> documents in a search result. Can the same instance even be reused
> among different threads?
>
> What would be the best way implementing MatchNoDocsQuery? My initial
> tests show that a new BooleanQuery() without any additional clauses
> would just do the job, but I just wanted to double check whether this
> is be a reliable assumption. Above questions also apply - could this
> be reused among different contexts, threads?
>
> Thanks in advance.
>
> Regards,
> Mindaugas
>
> ---------------------------------------------------------------------
> 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