lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Høydahl <jan....@cominvent.com>
Subject Re: facet on two multi-valued fields
Date Thu, 03 Mar 2016 12:51:16 GMT
Hi,

BlockJoin with Parent/Child is your solution.
See http://yonik.com/solr-nested-objects/ and https://cwiki.apache.org/confluence/display/solr/BlockJoin+Faceting

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

> 3. mar. 2016 kl. 10.35 skrev Andreas Hubold <andreas.hubold@coremedia.com>:
> 
> Hi,
> 
> sorry, the subject may have been misleading. I want to get facet results for only one
field (tagIds) but restrict the returned values to those with a matching tagDescription. Both
multi-valued fields have the same order.
> 
> Example docs
> 
> id:"1"
> tagIds:["10","12","13"]
> tagDescriptions:["News", "Sport News", "Economy"]
> text:"... foo ..."
> 
> id:"2"
> tagIds:["14", "10"]
> tagDescriptions:["IT", "News"]
> text:"... foo ..."
> 
> Query
> q=text:foo
> &fq=tagDescriptions:news
> &facet.field=tagIds
> 
> IIRC, this would give me a facet result with values 10, 12, 13, 14 but I want to restrict
the result to 10, 12 (the ones with "News" in their tagDescription)
> 
> I thought about using query-time join but am unsure about performance implications (if
there are many tags) and concrete usage.
> 
> Or is it possible to somehow put both tagIds and tagDescriptions into a single multi-valued
field?
> 
> Thank you,
> Andreas
> 
> 
> Jan Høydahl schrieb am 02.03.2016 um 22:52:
>> It makes no sense to facet on a “text_general” ananlyzed field. Can you give
a concrete example with a few dummy docs and show some queries (do you query the tagDescription
field?) and wanted facet output?
>> 
>> There may be several ways to solve the task, depending on the exact use case. One
solution could be to use child documents.
>> 
>> --
>> Jan Høydahl, search solution architect
>> Cominvent AS - www.cominvent.com
>> 
>>> 2. mar. 2016 kl. 17.30 skrev Andreas Hubold <andreas.hubold@coremedia.com>:
>>> 
>>> Hi,
>>> 
>>> my schema looks like this
>>> 
>>> <field name="id" type="string" .../>
>>> <field name="tagIds" type="string" indexed="true" stored="true" multiValued="true"/>
>>> <field name="tagDescriptions" type="text_general" indexed="true" stored="false"
multiValued="true"/>
>>> <field name="text" type="text_general" .../>
>>> 
>>> I'd like to get the tagIds of documents with a certain tagDescription (and text).
However tagIds contains multiple ids in the same order as tagDescription and simple faceting
would return all. Is there a way to just get the IDs of the tags with a matching description?
>>> 
>>> Or would you recommend some other schema?
>>> 
>>> Thanks,
>>> Andreas
>>> 
>>> 
>> 
> 


Mime
View raw message