You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Miller <cm...@servermotion.com> on 2009/05/15 02:46:41 UTC

Search Query Questions

I have two questions:

1) How do I search for ALL items? For example, I provide a sort query  
parameter of "updated" and a rows query parameter of 10 to limit the  
query results. I still have to provide a search query, of course. What  
if I want to provide a list of ALL results that match this? Or, in  
this case, the most recent 10 updated documents?

2) How do I search for all documents with a field that has data? For  
example, I have a field "foo" that is optional and multi-valued. How  
do I search for documents that have this field set to anything.

Thanks,

Chris Miller
ServerMotion
www.servermotion.com




Re: Search Query Questions

Posted by Matt Weber <ma...@mattweber.org>.
I think you will want to look at the Field Collapsing patch for this.  http://issues.apache.org/jira/browse/SOLR-236 
.

Thanks,

Matt Weber
eSr Technologies
http://www.esr-technologies.com




On May 14, 2009, at 5:52 PM, Chris Miller wrote:

> Oh, one more question....
>
> 3) Is there a way to effectively do a GROUP BY? For example, if I  
> have a document that has a photoID attached to it, is there a way to  
> return a set of results that does not duplicate the photoID field?
>
> Thanks,
>
> Chris Miller
> ServerMotion
> www.servermotion.com
>
>
>
> On May 14, 2009, at 7:46 PM, Chris Miller wrote:
>
>> I have two questions:
>>
>> 1) How do I search for ALL items? For example, I provide a sort  
>> query parameter of "updated" and a rows query parameter of 10 to  
>> limit the query results. I still have to provide a search query, of  
>> course. What if I want to provide a list of ALL results that match  
>> this? Or, in this case, the most recent 10 updated documents?
>>
>> 2) How do I search for all documents with a field that has data?  
>> For example, I have a field "foo" that is optional and multi- 
>> valued. How do I search for documents that have this field set to  
>> anything.
>>
>> Thanks,
>>
>> Chris Miller
>> ServerMotion
>> www.servermotion.com
>>
>>
>>
>


Re: Search Query Questions

Posted by Chris Miller <cm...@servermotion.com>.
Oh, one more question....

3) Is there a way to effectively do a GROUP BY? For example, if I have  
a document that has a photoID attached to it, is there a way to return  
a set of results that does not duplicate the photoID field?

Thanks,

Chris Miller
ServerMotion
www.servermotion.com



On May 14, 2009, at 7:46 PM, Chris Miller wrote:

> I have two questions:
>
> 1) How do I search for ALL items? For example, I provide a sort  
> query parameter of "updated" and a rows query parameter of 10 to  
> limit the query results. I still have to provide a search query, of  
> course. What if I want to provide a list of ALL results that match  
> this? Or, in this case, the most recent 10 updated documents?
>
> 2) How do I search for all documents with a field that has data? For  
> example, I have a field "foo" that is optional and multi-valued. How  
> do I search for documents that have this field set to anything.
>
> Thanks,
>
> Chris Miller
> ServerMotion
> www.servermotion.com
>
>
>


Re: Search Query Questions

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 14, 2009, at 8:46 PM, Chris Miller wrote:
> 1) How do I search for ALL items? For example, I provide a sort  
> query parameter of "updated" and a rows query parameter of 10 to  
> limit the query results. I still have to provide a search query, of  
> course. What if I want to provide a list of ALL results that match  
> this? Or, in this case, the most recent 10 updated documents?

   *:*

> 2) How do I search for all documents with a field that has data? For  
> example, I have a field "foo" that is optional and multi-valued. How  
> do I search for documents that have this field set to anything.

foo:[* TO *] for all documents with a foo field or -foo:[* TO *] for  
all documents without a foo field.

	Erik