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 ninaddesai82 <de...@gmail.com> on 2012/11/28 14:35:38 UTC

multiple filter query with seperate result sets (in one call)

Hi, 

I want to have multiple search at a time with grouped result.
i.e. 
If I am calling
http://localhost:8983/solr/file/select?q=*&fq=category:wild&fq=health_status:good&fq=animal:lion+OR+tiger

Then I need two results one for
 {category=wild and health_status=good and animal=lion} 
and second one is 
 {category=wild and health_status=good and animal=lion}

along with matched number of results. 

In other words, I want to pawn more than one search in a single query with
seperate search results (without mixing the results).

How can I do that ?

- n





--
View this message in context: http://lucene.472066.n3.nabble.com/multiple-filter-query-with-seperate-result-sets-in-one-call-tp4022912.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: multiple filter query with seperate result sets (in one call)

Posted by Erick Erickson <er...@gmail.com>.
You might look into joins. Be aware that the sweet spot for joins is when
the field you're joining on doesn't have a huge number of unique values per
document.

But that's about all I can think of offhand

Best
Erick


On Thu, Nov 29, 2012 at 1:29 AM, ninaddesai82 <de...@gmail.com> wrote:

> Thanks Erick for replying,
>
> Well, I am actually trying to build a autosuggestion; However functionality
> I need is little bit tricky.
> So, just to give you an idea -
>
> I have certain generic attributes (say category, city etc)
> When use types, I want autosuggest to populate, but while doing that I want
> only results to autopopulate which satisfies filter of my preselected
> attributes (category and city which user had already selected).
>
> So.... e.g. user selected category food, and city san fransisco
> and if he tries to type lets say "app"
>
> I might have 50 auto population results, out of which I want to search in
> solr, how many returns results pertaining to above said attributes. (other
> wise even if apple store is valid auto population, if its not present in
> food and san fransisco, it wont be valid auto population).
>
> So, I am trying to do background search in solr, where I could find
> validity
> of auto population phrases results and only return valid ones. But to do
> this, I will have to pawn 50 searches (solr) ,adn then logic to check how
> many results are being returned.
> Instead I was hoping ... if I can do only one search for all those 50
> criterias in solr and get grouped results, it will be awesome and
> optimized.
>
> Any other idea you have in mind ?
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/multiple-filter-query-with-seperate-result-sets-in-one-call-tp4022912p4023184.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: multiple filter query with seperate result sets (in one call)

Posted by ninaddesai82 <de...@gmail.com>.
Thanks Erick for replying,

Well, I am actually trying to build a autosuggestion; However functionality
I need is little bit tricky.
So, just to give you an idea -

I have certain generic attributes (say category, city etc)
When use types, I want autosuggest to populate, but while doing that I want
only results to autopopulate which satisfies filter of my preselected
attributes (category and city which user had already selected).

So.... e.g. user selected category food, and city san fransisco
and if he tries to type lets say "app"

I might have 50 auto population results, out of which I want to search in
solr, how many returns results pertaining to above said attributes. (other
wise even if apple store is valid auto population, if its not present in
food and san fransisco, it wont be valid auto population).

So, I am trying to do background search in solr, where I could find validity
of auto population phrases results and only return valid ones. But to do
this, I will have to pawn 50 searches (solr) ,adn then logic to check how
many results are being returned. 
Instead I was hoping ... if I can do only one search for all those 50
criterias in solr and get grouped results, it will be awesome and optimized.

Any other idea you have in mind ?




--
View this message in context: http://lucene.472066.n3.nabble.com/multiple-filter-query-with-seperate-result-sets-in-one-call-tp4022912p4023184.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: multiple filter query with seperate result sets (in one call)

Posted by Erick Erickson <er...@gmail.com>.
I don't think you can. What's the use-case you're really looking at? You
could
consider grouping/field collapsing, which sounds related,
see: http://wiki.apache.org/solr/FieldCollapsing

Best,
Erick


On Wed, Nov 28, 2012 at 8:35 AM, ninaddesai82 <de...@gmail.com> wrote:

> Hi,
>
> I want to have multiple search at a time with grouped result.
> i.e.
> If I am calling
>
> http://localhost:8983/solr/file/select?q=*&fq=category:wild&fq=health_status:good&fq=animal:lion+OR+tiger
>
> Then I need two results one for
>  {category=wild and health_status=good and animal=lion}
> and second one is
>  {category=wild and health_status=good and animal=lion}
>
> along with matched number of results.
>
> In other words, I want to pawn more than one search in a single query with
> seperate search results (without mixing the results).
>
> How can I do that ?
>
> - n
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/multiple-filter-query-with-seperate-result-sets-in-one-call-tp4022912.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>