Handling empty query

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Handling empty query

Guangwei Yuan
Hi,

Does Solr support empty queries? It'll be nice if Solr can return all
results if q is null. Otherwise, I guess I'll have to write a customized
request handler. Any thoughts?

Thanks in advance.

- Guangwei
Reply | Threaded
Open this post in threaded view
|

RE: Handling empty query

Lance Norskog-2
If a field is required, and always has data, this query will enumerate all
documents:

field:[* TO *]

-----Original Message-----
From: Guangwei Yuan [mailto:[hidden email]]
Sent: Thursday, October 04, 2007 3:26 PM
To: [hidden email]
Subject: Handling empty query

Hi,

Does Solr support empty queries? It'll be nice if Solr can return all
results if q is null. Otherwise, I guess I'll have to write a customized
request handler. Any thoughts?

Thanks in advance.

- Guangwei

Reply | Threaded
Open this post in threaded view
|

Re: Handling empty query

Mike Klaas
In reply to this post by Guangwei Yuan
On 4-Oct-07, at 3:25 PM, Guangwei Yuan wrote:

> Does Solr support empty queries? It'll be nice if Solr can return all
> results if q is null. Otherwise, I guess I'll have to write a  
> customized
> request handler. Any thoughts?

The dismax handler has an "alt.q" parameter which is used as the  
query if the queyr string is emtpy.

To return all documents, set "alt.q=*:*"

-Mike

Reply | Threaded
Open this post in threaded view
|

Re: Handling empty query

Christopher Triggs
Have a look at  
http://www.mail-archive.com/solr-user@.../msg03394.html

The thread goes on to describe that just using q=*:* is efficient and  
is very usefull for getting facets for browsing / navigation.

Regards,
Triggsie

> On 4-Oct-07, at 3:25 PM, Guangwei Yuan wrote:
>
>> Does Solr support empty queries? It'll be nice if Solr can return all
>> results if q is null. Otherwise, I guess I'll have to write a customized
>> request handler. Any thoughts?
>
> The dismax handler has an "alt.q" parameter which is used as the query
> if the queyr string is emtpy.
>
> To return all documents, set "alt.q=*:*"
>
> -Mike
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.