Sure, sorry for the inconvenience.

I'm having a little trouble trying to make a query in Solr. The problem is:
I must be able retrieve documents that have the same value for a specified
field, but they should only be retrieved if this value appeared more than X
times for a specified user. In pseudosql it would be something like:

select user_id from documents
where my_field="my_value"
and
(select count(*) from documents where my_field="my_value" and
user_id=super.user_id) > X

I Know that solr return a 'numFound' for each query you make, but I dont
know how to retrieve this value in a subquery.

My Solr is organized in a way that a user is a document, and the properties
of the user (such as name, age, etc) are grouped in another document with a
'root_id' field. So lets suppose the following query that gets all the root
documents whose children have the prefix "some_prefix".

is_root:true AND _query_:"{!join from=root_id
to=id}requests_prefix:\"some_prefix\""

Now, how can I get the root documents (users in some sense) that have more
than X children matching 'requests_prefix:"some_prefix"' or any other
condition? Is it possible?

P.S. It must be done in a single query, fields can be added at will, but
the root/children structure should be preserved (preferentially).


2013/9/27 Upayavira <u...@odoko.co.uk>

> Mattheus,
>
> Given these mails form a part of an archive that are themselves
> self-contained, can you please post your actual question here? You're
> more likely to get answers that way.
>
> Thanks, Upayavira
>
> On Fri, Sep 27, 2013, at 04:36 PM, Matheus Salvia wrote:
> > Hello everyone,
> > I'm having a problem regarding how to make a solr query, I've posted it
> > on
> > stackoverflow.
> > Can someone help me?
> >
> http://stackoverflow.com/questions/19039099/apache-solr-count-of-subquery-as-a-superquery-parameter
> >
> > Thanks in advance!
> >
> > --
> > --
> >  // Matheus Salvia
> > Desenvolvedor Mobile
> > Celular: +55 11 9-6446-2332
> > Skype: meta.faraday
>



-- 
--
 // Matheus Salvia
Desenvolvedor Mobile
Celular: +55 11 9-6446-2332
Skype: meta.faraday

Reply via email to