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 MitchK <mi...@web.de> on 2010/07/21 11:05:32 UTC

nested query and number of matched records

Hello community,

I got a situation, where I know that some types of documents contain very
extensive information and other types are giving more general information.
Since I don't know whether a user searches for general or extensive
information (and I don't want to ask him when he uses the default search), I
want to give him a response back like this:

10 documents are type: short
1 document, if there is one, is type: extensive

An example query would look like this:
q={!dismax fq=type:short}my cool query OR {!dismax fq=type:extensive}my cool
query
The problem with this one will be, that I can not specify to retrive up to
10 short-documents and at most one extensive.

I think this will not work and if I want to create such a search, I need to
do two different queries. But before I waste performance, I wanted to ask.

Thank you!
Kind regards,
- Mitch
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p983756.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: nested query and number of matched records

Posted by kenf_nc <ke...@realestate.com>.
That just gives a count of documents by type. The use-case, I believe, is to
return from a search, 10 documents of type 'short' and 1 document of type
'extensive'. 
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p984539.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: nested query and number of matched records

Posted by MitchK <mi...@web.de>.
Thank you three for your feedback!

Chantal, unfortuntately kenf is right. Facetting won't work in this special
case. 


> parallel calls.
> 
Yes, this will be the solution. However, this would lead to a second
HTTP-request and I hoped to be able to avoid it.


Chantal Ackermann wrote:
> 
> Sure SOLR supports this: use facets on the field "type":
> 
> add to your regular query:
> 
> facet.query=true&facet.field=type
> 
> see http://wiki.apache.org/solr/SimpleFacetParameters
> 
> 
> On Wed, 2010-07-21 at 15:48 +0200, kenf_nc wrote:
>> parallel calls. simultaneously query for type:short rows=10  and
>> type:extensive rows=1  and merge your results.  This would also let you
>> separate your short docs from your extensive docs into different solr
>> instances if you wished...depending on your document architecture this
>> could
>> speed up one or the other.
> 
> 
> 
> 
> 
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p984750.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: nested query and number of matched records

Posted by Chantal Ackermann <ch...@btelligent.de>.
Sure SOLR supports this: use facets on the field "type":

add to your regular query:

facet.query=true&facet.field=type

see http://wiki.apache.org/solr/SimpleFacetParameters


On Wed, 2010-07-21 at 15:48 +0200, kenf_nc wrote:
> parallel calls. simultaneously query for type:short rows=10  and
> type:extensive rows=1  and merge your results.  This would also let you
> separate your short docs from your extensive docs into different solr
> instances if you wished...depending on your document architecture this could
> speed up one or the other.




Re: nested query and number of matched records

Posted by kenf_nc <ke...@realestate.com>.
parallel calls. simultaneously query for type:short rows=10  and
type:extensive rows=1  and merge your results.  This would also let you
separate your short docs from your extensive docs into different solr
instances if you wished...depending on your document architecture this could
speed up one or the other.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p984280.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: nested query and number of matched records

Posted by MitchK <mi...@web.de>.
Oh,... I just see, there is no direct question ;-).

How can I specify the number of returned documents in the desired way
*within* one request?

- Mitch
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p983773.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: nested query and number of matched records

Posted by "Grijesh.singh" <pi...@gmail.com>.
I Think Solr does not provide any thing like that U want.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/nested-query-and-number-of-matched-records-tp983756p983938.html
Sent from the Solr - User mailing list archive at Nabble.com.