I don't think you can do it, as pivot
faceting<http://wiki.apache.org/solr/SimpleFacetParameters#Pivot_.28ie_Decision_Tree.29_Faceting>
doesn't
let you use facet queries.  The closer query I can imagine is:


   - q=sentence:bar OR sentence:foo
   - facet=true
   - facet.pivot=media_id,sentence

At least the q will make faceting only by those documents containing foo
and bar but depending on the size of sentence field you cant get a huge
response.

Hope it helps.


On Wed, Mar 26, 2014 at 11:12 PM, David Larochelle <
dlaroche...@cyber.law.harvard.edu> wrote:

> I have the following schema
>
> <field name="id" type="string" indexed="true" stored="true" required="true"
> multiValued="false" />
> <field name="media_id" type="int" indexed="true" stored="true"
> required="false" multiValued="false" />
> <field name="sentence"  type="text_general" indexed="true" stored="true"
> termVectors="true" termPositions="true" termOffsets="true" />
>
>
> I'd like to be able to facet by a field and then by queries. i.e.
>
>
> facet_fields": {"media_id": ["1":{ "sentence:foo": 102410, "sentence:bar":
> 29710}"2":
> { "sentence:foo": 600, "sentence:bar": 220}
> "3":
> { "sentence:foo": 80, "sentence:bar": 2330}]}
>
>
> However, when I try:
>
> http://localhost:8983/solr/collection1/select?q=*:*&wt=json&indent=true&facet=true&facet.query=sentence%3A%foo&facet.query=sentence%3Abar&facet.field=media_id
>
> the facet counts for the queries and media_id are listed separately rather
> than hierarchically.
>
> I realize that I could use 2 separate requests and programmatically combine
> the results but would much prefer to use a single Solr request.
>
> Is there any way to go this in Solr?
>
> Thanks in advance,
>
>
> David
>

Reply via email to