Controlled vocabulary in custom filters | Community
Skip to main content
dmescia2
Level 3
September 28, 2023
Solved

Controlled vocabulary in custom filters

  • September 28, 2023
  • 2 replies
  • 1516 views

Does anyone know how to set up a controlled vocabulary in custom filter fields? Preferably typeahead vocabularies because some of these filter fields could have thousands of options.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Adilos-Cantuerk

The behavior you are showing with the tags filter above is the behavior I'm hoping to accomplish in our DAM. But I am hoping to tie tags to custom fields. For example we'll build a hierarchy in tags for vehicle make, then apply those tags to a field for vehicle make. We were able to do something like that in the metadata tagging windows via a json file but that json list doesn't seem to be an option we can use for the custom field we create in the filters search rail. In a perfect world instead of the json file I could just have the section of my tagging structure that deals with vehicle make be the options for that field in the properties as well as the corresponding field in my filters. And if I can't use that tagging hierarchy, I'd like to at least be able to use that same json file for both. 


I hope i understood you right...

Lets say you have a tagging structure like this:
Namespace:Level1-tag/Level2-tag/Level3-tag
Your structure include the following namespaces: "vehicle makes", "models" and "trims" and each of those contain a hierarchy of tags.
You want the user to navigate it like that:
Go to the first filter, "Vehicle makes", type in something and get ONLY autofill resposes of tags that are existing as a tag under the namespace "vehicle makes"
Then the user has to go to the next filter "models" to then type in something that has to be an available tag option in models and so on...

If this is your desired outcome - please try this:
Go to your admin search rail and create create 3 tag filter predicates.
Set their root path, each to their dedicated namespace and name the filter accordingly.
"vehicle makes" to  /content/cq:tags/vehicle-makes 
"models" to /content/cq:tags/models and so on...
Now the user has 3 filters, which only give autofill responses based of the root path of that filter and the available tags within that structure. 

If i got you wrong, please tell me where i have lost you.

2 replies

Adilos-Cantuerk
Community Advisor
Community Advisor
October 2, 2023

Hi @dmescia2 , could you please elaborate a bit about the use case? 

In our case, the only filter that gives the user the option to write something in,
is the tag-property predicate and this gets its valid options/typeahead based of the available tags.
In addition, since there are a lot of options, we had multiple tag properties with different root paths.
The tag property also gives this "open selection dialog" button to explore the tagging structure.

Most of the other search filters that we use are option predicates.

dmescia2
dmescia2Author
Level 3
October 4, 2023

We are locking down the vocabulary for specific fields when tagging. For example, vehicle makes, models and trims. When users are searching for assets and filtering using the search rail on the left I would like to be able to use those same controlled vocabularies in those filter fields so people can't free type things. 

Adilos-Cantuerk
Community Advisor
Community Advisor
October 5, 2023

In case you use the tags filter, i am not aware if you could make the text field so controlled that only correct letter combinations can be typed in. Since only correct tags get you a result you get a autofill based of your tagging structure.

You can create multiple tag filters, with different root paths - and put them in the order in which  users receive the best search results.

You can also use the option predicate, which gives the user checkboxes you want them to have, and use tags as values for these checkboxes.
Depending on the amount of options a filter needs to have, this became the most prefered option for my users.

 

 

kautuk_sahni
Community Manager
Community Manager
October 4, 2023

@dmescia2 Did you find the suggestions from Adilos helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni