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 Darniz <rn...@edmunds.com> on 2015/01/09 20:14:59 UTC

filter on solr pivot data

Hello

i need to know how can i filter on solr pivot data.

For exampel we have a dealer which might have many cars in his lot and car
has photos, i need to find out a dealer which has cars which has no photos

so i have 

dealer1 -> has 20 cars -> all of them has photos
dealer2 -> has 20 cars ->  some of them have photos
dealer3 -> has 20 cars -> none of them have photos

in the results i want to see only dealers which has no photos ie dealer3, i
managed to do pivot and get a breakdown by vin and photo exists now i want
to apply filter and get  only those dealer who has all vin which have photo
exists as 0



lst name="facet_pivot">
<arr name="vin,mappings_|photo_exist|">
<lst>
<str name="field">vin</str>
<str name="value">1N4AA5AP0EC908535</str>
<int name="count">1</int>
<arr name="pivot">
<lst>
<str name="field">mappings_|photo_exist|</str>
<str name="value">1</str>
<int name="count">1</int>
</lst>
</arr>
</lst>
<lst>
<str name="field">vin</str>
<str name="value">1N4AA5AP1EC470625</str>
<int name="count">1</int>
<arr name="pivot">
<lst>
<str name="field">mappings_|photo_exist|</str>
<str name="value">1</str>
<int name="count">1</int>
</lst>
</arr>
</lst>

is it possible



--
View this message in context: http://lucene.472066.n3.nabble.com/filter-on-solr-pivot-data-tp4178451.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: filter on solr pivot data

Posted by Darniz <rn...@edmunds.com>.
Thanks for the reply

but a filter query like -[* TO *] will give me vins which dont have a photo,
it might qualify a dealer to show up but what if that dealer has other vin
which has photo

my requirement is i want to show the dealer only if all vin  have no photos



--
View this message in context: http://lucene.472066.n3.nabble.com/filter-on-solr-pivot-data-tp4178451p4179011.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: filter on solr pivot data

Posted by Erick Erickson <er...@gmail.com>.
Why not just add an fq clause like &fq=-mappings_iphoto_exist:[* TO *]?

note the "-" sign.....

On Fri, Jan 9, 2015 at 11:14 AM, Darniz <rn...@edmunds.com> wrote:
> Hello
>
> i need to know how can i filter on solr pivot data.
>
> For exampel we have a dealer which might have many cars in his lot and car
> has photos, i need to find out a dealer which has cars which has no photos
>
> so i have
>
> dealer1 -> has 20 cars -> all of them has photos
> dealer2 -> has 20 cars ->  some of them have photos
> dealer3 -> has 20 cars -> none of them have photos
>
> in the results i want to see only dealers which has no photos ie dealer3, i
> managed to do pivot and get a breakdown by vin and photo exists now i want
> to apply filter and get  only those dealer who has all vin which have photo
> exists as 0
>
>
>
> lst name="facet_pivot">
> <arr name="vin,mappings_|photo_exist|">
> <lst>
> <str name="field">vin</str>
> <str name="value">1N4AA5AP0EC908535</str>
> <int name="count">1</int>
> <arr name="pivot">
> <lst>
> <str name="field">mappings_|photo_exist|</str>
> <str name="value">1</str>
> <int name="count">1</int>
> </lst>
> </arr>
> </lst>
> <lst>
> <str name="field">vin</str>
> <str name="value">1N4AA5AP1EC470625</str>
> <int name="count">1</int>
> <arr name="pivot">
> <lst>
> <str name="field">mappings_|photo_exist|</str>
> <str name="value">1</str>
> <int name="count">1</int>
> </lst>
> </arr>
> </lst>
>
> is it possible
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/filter-on-solr-pivot-data-tp4178451.html
> Sent from the Solr - User mailing list archive at Nabble.com.