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 Tim Underwood <ti...@gmail.com> on 2009/11/13 00:48:09 UTC

Re: having solr generate and execute other related queries automatically

>
>
> Unfortunately no.  the +20 queries are distinct from each other, even tho
> they share some of the original query parameters (and some facet
> information
> from the original query facets).
>
> what I was envisioning was something that works like a facet, but instead
> of
> returning information about the first query, it would return information
> about queries similar to the first query.
>

Maybe I misunderstand what you are trying to do (or the facet.query
feature).  If I did an initial query on my data-set that left me with the
following questions:

1. How many products are in brand 1?
2. How many products are in brand 2?
3. How many products are in brand 5 and category 4051?
4. etc...  (however many other arbitrary queries I want to get counts for)

I could use facet.query parameters to answer those with something like:

http://localhost:8983/solr/select/?q=*%3A*&start=0&rows=0&facet=on&facet.query=brand_id:1&facet.query=brand_id:2&facet.query=+%2Bbrand_id:5+%2Bcategory_id:4051

Where the parameters are:

q=*:*
start=0
rows=0
facet=on
facet.query=brand_id:1
facet.query=brand_id:2
facet.query=+brand_id:5 +category_id:4051

My response looks like:

<response>
<result name="response" numFound="926626" start="0"/>
<lst name="facet_counts">
 <lst name="facet_queries">
  <int name="brand_id:1">1450</int>
  <int name="brand_id:2">1047</int>
  <int name=" +brand_id:5 +category_id:4051">21</int>
 </lst>
 <lst name="facet_fields"/>
 <lst name="facet_dates"/>
</lst>
</response>


Are you talking about a different problem?  Do you have a simple example?

-Tim

Re: having solr generate and execute other related queries automatically

Posted by gdeconto <ge...@topproducer.com>.

tpunder wrote:
> 
> Maybe I misunderstand what you are trying to do (or the facet.query
> feature).  If I did an initial query on my data-set that left me with the
> following questions:
> ...
> http://localhost:8983/solr/select/?q=*%3A*&start=0&rows=0&facet=on&facet.query=brand_id:1&facet.query=brand_id:2&facet.query=+%2Bbrand_id:5+%2Bcategory_id:4051
> ...
> 

Thanks for the reply Tim.

I can't provide you with an example as I dont have anything prototyped as
yet; I am still trying to work things thru in my head.  The +20 queries
would allow us to suggest other possibilities to users in a facet-like way
(but not returning the exact same info as facets).

With the technique you mention I would have to specify the list of query
params for each facet.query.  That would work for relatively simple queries. 
Unfortunately, the queries I was looking at doing would be fairly long (say
hundreds of AND/OR statements).   That said, I dont think solr would be able
to handle the query size I would end up with (at least not efficiently),
because the resulting query would consist of thousands of AND/OR statements
(isnt there a limit of sorts in Solr?)

I think that my best bet would be to extend the SearchComponent and perform
the additional query generation and execution in the extension.  That
approach should also allow me to have access to the facet values that the
base query would generate (which would allow me to generate and execute the
other queries).

thx again.
-- 
View this message in context: http://old.nabble.com/having-solr-generate-and-execute-other-related-queries-automatically-tp26327032p26343409.html
Sent from the Solr - User mailing list archive at Nabble.com.