question

AayushSahIND-3128 avatar image
0 Votes"
AayushSahIND-3128 asked ajkuma-MSFT answered

path_hierarchy_v2 not working along with facet field in Azure cognitive search

I am unable to use path_hierarchy_v2 tokenizer in the facet field. But while analyzing the text with analyze api it tokenizes the text in path hierarchy.
{
"text": "a/b/c",
"analyzer": "my_path_analyzer"
}

I am unable to use path_hierarchy_v2 tokenizer in the facet field. But while analyzing the text with analyze api it tokenizes the text in path hierarchy.

  {
   "text": "a/b/c",
   "analyzer": "my_path_analyzer"
  }

this gives:

 a, a/b, a/b/c

but while using with facet it does not work.

and the result it returns is:

  {
   "count": 2,
   "value": "a/b/c"
  }

But i want to get something like this

  {
   "count": 2,
   "value": "a"
  },
 {
   "count": 1,
   "value": "a/b"
  },
 {
   "count": 1,
   "value": "a/b/c"
  }

This is my field mapping:

 {
       "name": "hierarchy_field",
       "type": "Edm.String",
       "facetable": true,
       "filterable": true,
       "key": false,
       "retrievable": true,
       "searchable": true,
       "sortable": true,
       "analyzer": "my_path_analyzer",
       "indexAnalyzer": "",
       "searchAnalyzer": "",
       "synonymMaps": []
 }




azure-cognitive-search
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AayushSahIND-3128, Thanks for posting this good question!

Apologies for the delay in responding here. I'm taking a look into this and will get back to you shortly.

0 Votes 0 ·

@AayushSahIND-3128, I would like to gather some more info on the requirement and your subscription details (PII), so I'll reach out you privately.

I see that you have also posted this question on SO, I will follow-up there as well.


0 Votes 0 ·

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

@AayushSahIND-3128, I'd shared this on your SO thread and also was expecting your reply to my private comment here.

You may try to break that down during pre-processing and assign each 'tier' of the hierarchy to a different field, as below:

 Top_Level_Field=”a/b/c”
   
 Next_Level_Field=”b/c”
    
 Bottom_Level_Field=”c”

Typically, each facet tier can have different values but you need to have a pre-determined hierarchy depth.
Kindly let us know if you have any further questions on this.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.