lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florin Mandoc <flori...@mejix.com>
Subject Additional field in facet result
Date Fri, 20 Nov 2015 15:55:34 GMT
Hi, I have a index that contains products and tags as nested children, 
like below:

{
         "id":"413863",
         "ProductID":"413863",
         "type":"product",
         "MainProductID":"",
         "SKU":"8D68595B",
         "Name":"mere",
         "alltext":["mere",
           "",
           "",
           "test product"],
         "CustomName":"",
         "CategoryID":0,
         "CategoryName":"",
         "MasterCategoryID":"0",
         "MasterCategoryName":"",
         "ShortDescription":"test product",
         "UomID":"",
         "Uom":"dz",
         "UomSize":"0.9",
         "ImageName":"",
         "AllowFractionOrdering":"false",
         "DisplayOrder":0,
         "InternalSku":"8D68595B",
         "PrivateProduct":"true",
         "GroupedProduct":"",
         "ProductGroupID":"-1",
         "UomSizeParentID":"",
         "CustomerSiteID":"4553",
         "CustomerAccountID":"2323",
         "IsAccountProduct":"true",
         "IsVariation":"",
         "Tags":["<TagID>1754</TagID><TagName>ztag</TagName>"],
         "Vendors":["<VendorID>4554</VendorID><VendorSKU>qw</VendorSKU>"],
         "_version_":1518371006298718216,
         "_childDocuments_":[
         {
           "id":"413863_1754",
           "type":"tag",
           "TagID":1754,
           "TagName":"ztag",
           "ProductID":"413863"},
         {
           "id":"413863_4554_qw",
           "type":"vendor",
           "VendorID":4554,
           "VendorSKU":"qw",
           "ProductID":"413863"}]}


I am using this query to get the products and facets for tags:

http://localhost:8983/solr/favsearch/select?q=*:*&wt=json&indent=true&start=0&rows=100&&fl=*,[child%20parentFilter=type:product]&fq=CustomerSiteID:4553&json.facet={tags:{type:%20terms,field:TagName,domain:%20{%20blockChildren%20:%20%22type:product%22%20}},categories:{type:%20terms,field:CategoryID}}

The facets response is:

"facets":{
     "count":15,
     "tags":{
       "buckets":[{
           "val":"vendor 1",
           "count":3},
         {
           "val":"vendor 2",
           "count":3},
         {
           "val":"ztag",
           "count":2}]},
     "categories":{
       "buckets":[{
           "val":-1,
           "count":5}]}}}


Is it possible to get in the response the field TagID also?
Or if I add another facet field for tag ids, like this

"facets":{
     "count":15,
     "tagNames":{
       "buckets":[{
           "val":"vendor 1",
           "count":3},
         {
           "val":"vendor 2",
           "count":3},
         {
           "val":"ztag",
           "count":2}]},
     "tagId":{
       "buckets":[{
           "val":1752,
           "count":3},
         {
           "val":1753,
           "count":3},
         {
           "val":1754,
           "count":2}]},
     "categories":{
       "buckets":[{
           "val":-1,
           "count":5}]}}}

can I be sure that always the first bucket from tagNames corresponds to 
the first bucket of tagId?

Thank you,
Florin


Mime
View raw message