CMS : Full-Text Query : Search using trait in facet

Options

I have a requirement to search using trait in facet , but the query is returnig emty results for trait

fields and "cms_not_found" for trait field in "facet_fields_label"

Answers

  • LazarescuA
    Options

    Hello @MohamedRC ,

    I am not sure if your fields are spelled correctly as I see the second one with double I (Iincoming).

    To make sure you have the right name of the field, you can list the trait attributes (/cms/trait-definitions/<your_trait>/attributes) and check the search_name:

    That is the name you need to use (my tenant is on search v1, hence the dot notation, yours is on v2 so you will have __ notation).

    Then, use it as a facet field:

    And you will get the facets:

  • MohamedRC
    MohamedRC Member
    edited April 1 #3
    Options

    Hello @LazarescuA, I'm in search v2 and the search worked for me only with "facet.field" , the instance name is correct (""Iincoming")

    And if I use the search name of the trait attribute "trait_corres_case_trait.Incoming Case Trait.case_id__s" , got this error :

  • MohamedRC
    Options

    @LazarescuA , having the same thing when using "cms_any.trait_names_ss" as facet.field , what could be the issue ? Thanks

  • LazarescuA
    LazarescuA E Member
    Options

    Hello,

    The search v2 engine needs the field names separated with double __.

    I guess in your first example, you will need:

    trait_corres_case_trait__Incoming Case Trait__case_id_s

    trait_corres_case_trait__Iincoming__case_id_s

    And in your second, you will need:

    cms_any__trait_names_ss

  • LazarescuA
    LazarescuA E Member
    Options

    But, to be more exact, you can run the following call:

    /cms/trait-definitions/corres_case_trai/attributes

    On the case_id attribute, see the search_name property, it should give you the right notation. Replace <instance> with your instance name.

  • MohamedRC
    Options

    Hello @LazarescuA

    I figured the issue is on the instance name , as you can see my instance name is "Incoming Case Trait"

    But it appears that for some reason in the facet.field instance name shouldn't contain spaces , so in conclusion

    what worked for me :

  • LazarescuA
    LazarescuA E Member
    Options

    Glad it worked in the end! V1 accepts spaces, good to know v2 does not.

  • LazarescuA
    LazarescuA E Member
    Options

    Actually, I just checked, in v1 it is exactly the same, sorry, you need to replace any space in the instance name with an _ (underscore)

  • MohamedRC
    Options

    Hello @LazarescuA , could please tell how I can have an exhaustive list of system properties like

    "cms_any__all_values" to be used in facet queries , I tried GET /cms/search-health , but it seems that it does not

    contain the full list . My requirement is to filter by parent folder id.

    Thank you.

  • LazarescuA
    Options

    Well, that is really easy. You just call the /cms/type-definitions/<type_name>?expandAll=true or /cms/type-definitions/<type_name>/attributes-all. Then, for each attribute, you will see the search name. Here is an example for /cms/type-definitions/cms_any:

    Yours will most probably be cms_any__parent_folder_id_s