Multi-select faceting for nested documents

2021-01-25 Thread Lance Snell
Hey all,

I am having trouble finding current examples of multi-select faceting for
nested documents.  Specifically ones with *multiple *levels of nested
documents.

My current schema has a parent document, two child documents(siblings), and
a grandchild document.  I am using the JSON API.

Product -> Sku -> Price
   |
   \/
StoreCategory

Any help/direction would be appreciated.


Solr. 8.6

-- 
Thanks,

Lance


Re: Multi-select faceting for nested documents

2021-01-25 Thread Lance Snell
Any examples would be greatly appreciated.

On Mon, Jan 25, 2021, 2:25 AM Lance Snell  wrote:

> Hey all,
>
> I am having trouble finding current examples of multi-select faceting for
> nested documents.  Specifically ones with *multiple *levels of nested
> documents.
>
> My current schema has a parent document, two child documents(siblings),
> and a grandchild document.  I am using the JSON API.
>
> Product -> Sku -> Price
>|
>\/
> StoreCategory
>
> Any help/direction would be appreciated.
>
>
> Solr. 8.6
>
> --
> Thanks,
>
> Lance
>


Re: Multi-select faceting for nested documents

2021-01-26 Thread Lance Snell
roupingFilter2}"
,
"topQuery_product":""

},
"fields":
"*, [child fl=$returnFields limit=-1
childFilter='/productItems/{!filters v=$child_FQ2}']"
,
"filter": [

// "${prdoc_Q2} {!parent which='*:* -_nest_path_:/*' v=$prdoc_Q2}
{!parent which='*:* -_nest_path_:/productItems/*' v=$prdoc_Q2}
categoryPrefixes:(ASB00434166111481 ASB0043416611148All)"

"_query_:(${prdoc_Q2} ${pcdoc_Q2} docType:pcdoc docType:prdoc
docType:pidoc docType:pdoc)"
,
"{!filters tag=MID param=$test v=$baseQ}"
],
"sort":
"{!parent which='*:* -_nest_path_:*' score=max v='+docType:prdoc
+{!func}fprice'} asc"
,
"offset": 0,
"limit": "${LIMIT}",
"facet": {
"testing": {
"type": "terms",
"field": "docType",
"limit": -1,
"facet": {
"parentCount": "unique(_root_)",
},
"domain":{
"excludeTags":[
"TOP",
//"MID",
// "LOW"
]
}
},
"testing2": {
"type": "terms",
"field": "docType",
"limit": -1,
        "facet": {
"parentCount": "unique(_root_)",
},
"domain":{
"excludeTags":[
"TOP",
"MID",
// "LOW"
]
}
}
}
}


On Mon, Jan 25, 2021 at 9:41 AM Alexandre Rafalovitch 
wrote:

> I don't have an answer, but I feel that maybe explaining the situation
> in more details would help a bit more. Specifically, you explain your
> data structure well, but not your actual presentation requirement in
> enough details.
>
> How would you like the multi-select to work, how it is working for you
> now and what is the gap?
>
> Regards,
>Alex.
> P.s. Sometimes, you have to really modify the way the information is
> stored in Solr for the efficient and effective search results. Solr is
> not the database, so it needs to model search requirements, rather
> than original data shape.
>
> On Mon, 25 Jan 2021 at 10:34, Lance Snell 
> wrote:
> >
> > Any examples would be greatly appreciated.
> >
> > On Mon, Jan 25, 2021, 2:25 AM Lance Snell 
> wrote:
> >
> > > Hey all,
> > >
> > > I am having trouble finding current examples of multi-select faceting
> for
> > > nested documents.  Specifically ones with *multiple *levels of nested
> > > documents.
> > >
> > > My current schema has a parent document, two child documents(siblings),
> > > and a grandchild document.  I am using the JSON API.
> > >
> > > Product -> Sku -> Price
> > >|
> > >\/
> > > StoreCategory
> > >
> > > Any help/direction would be appreciated.
> > >
> > >
> > > Solr. 8.6
> > >
> > > --
> > > Thanks,
> > >
> > > Lance
> > >
>


-- 
Thanks,

Lance Snell
(507) 829-7389


Nested documents (parent,child,grandchild), multi-select facets

2021-01-26 Thread Lance Snell
 Hey all,

I am having trouble finding current examples of multi-select faceting for
nested documents.  Specifically ones with *multiple *levels of nested
documents.

Any help/direction would be appreciated.Solr. 8.6

Hopefully my terminology is correct, I'm still new to solr.

My current schema has a parent document, two child documents(siblings), and
a grandchild document.  I am using the JSON API .

Product -> Item-> Price
   |
   \/
ProductCategory

I created my schema to represent a multi-store, and multi-customer setup.

I am looking for multi-select facets from *each* document.
Product document - General product information.  *Same for all customers*
Item document - Size/Color/etc.  Product variations.  *Same for all
customers*
Price document - Customer pricing.  *Unique per customer*
ProductCategory- Ids for linking Product to Store and Catalogs.  *Unique
per customer*

I was attempting to traverse from the child documents upwards, filtering on
( ProductCategory ), (Price/Item), and then finally combine the result of
both to get (Product).
Originally I was using '_nest_path_' for my blockMasks.  However I ended up
adding a 'path' field for each document, thinking this would give me more
control?? (ex. '1.product.item.price', '1.product.item', '1.product',
'2.product.item.price' , '2..product.item', etc. )


Below is my current query.

Currently when I remove the nested {!filters tag=ITEM...}, I get the
correct number of ProductCategory documents.  When I remove the nested
{!filters tag=PRODUCT_CATEGORY...},I get the correct number of Item
documents.
When I combine them both, I get *0* results.

Is this because the two nested filters ITEM and PRODUCT_CATEGORY are not
mutually exclusive?  If so could you point or provide an example.

OR

Is this because the ITEM and PRODUCT_CATEGORY filters are not filtering on
the Product documents yet, and they are both children of the Product
document?

OR

Am I not even close??


I thought I had seen some well written examples or videos of this in the
past, but I can't seem to find those examples anymore.   Any
help/direction/links would be greatly appreciated.


{
"params": {
"omitHeader": "true",
"defType": "edismax",
"df": "pdocname_txt_en_1",
"qf":
"pdocname_txt_en_1^2.0 description_txt_en_1^1.5
longDescription_txt_en_1^1.5 custItemNum_txt_en_split_tight_1^1.5"
,
"pf":
"pdocname_txt_en_1^3.0 description_txt_en_1^2.0
longDescription_txt_en_1^2.0 custItemNum_txt_en_split_tight_1^3"
,
"ps": "2",
"qs": "2",
"LIMIT": 0,
"prdoc_Q2":
"prefixes:ASB00434166111481 prefixes:ASB0043416611148All",
//Query entry point for price documents
"pcdoc_Q2":
"categoryPrefixes:ASB00434166111481
categoryPrefixes:ASB0043416611148All"
,   //Query entry point for product category
"BRAND_FILTER":"sku:SMB505",
"COLOR_FILTER":"",
"SIZE_FILTER":"",
"PRICE_FILTER":"fprice:[29 TO 30]",
"CATEGORY_FILTER":"categoryIds:2921",
"STORECATALOG_FILTER":"",
"productFQ":"{!parent filters=$pidocFQ which='path:2.product.item'}"
,
"productFilters":
"+{!parent which='path:2.product.item' v=$prdoc_Q2} +{!child
of='path:1.product.productCategory'}{!parent
which='path:1.product.productCategory' v=$pcdoc_Q2}"
,



"priceFilters":
"prefixes:(ASB00434166111481 ASB0043416611148All)",
//product filters
"productCategoryFilters":
"categoryPrefixes:(ASB00434166111481 ASB0043416611148All)",
//productCategory filters
"itemFilters":"docType:pidoc"
,   //item(skudocument) filters
"itemFQ":
"+(${priceFilters}) +{!child of='path:2.product.item'}{!q.op=AND
v=$itemFilters}"
, //Item filter query
"productCategoryFQ":"+(${productCategoryFilters})",
//ProductCategory filter query
"baseQ":
"categoryPrefixes:(ASB00434166111481 ASB0043416611148All)
prefixes:(ASB00434166111481 ASB0043416611148All) docType:pidoc
docType:pdoc -docType:catdoc -docType:stdoc -docType:cupsd"
,

"groupingFilter1":
"{!parent filters=$itemFQ which='path:2.product.item'}",
//Filter for priceDocument -> itemDocument
"groupingFilter2":"{!q.op=AND v=$productCategoryFQ}",
//Filter for productCategoryDocument -> productDocument
"test":
"{!filters tag=ITEM param=$groupingFilter1} {!filters
tag=PRODUCT_CATEGORY param=$groupingFilter2}"
,
"topQuery_product":""

},
"fields":
"*, [child fl=$returnFields limit=-1
childFilter='/productItems/{!filters v=$child_FQ2}']"
,
"filter": [

// "${prdoc_Q2} {!parent which='*:* -_nest_path_:/*' v=$prdoc_Q2}
{!parent which='*:* -_nest_path_:/productItems/*' v=$prdoc_Q2}
categoryPrefixes:(ASB00434166111481 ASB0043416611148All)"

"_query_:(${prdoc_Q2} ${pcdoc_Q2} docType:pcdoc docType:prdoc
docType:pidoc docType:pdoc)"
,
"{!filters tag=MID param=$test v=$baseQ}"
],
"sort"