Which make it kinda hard to filter by query on exact match…
Lets say country is stored as “Norway”.
Then query needs to be ‘data.country.name = “Norway”’
But aggregation country returns ‘norway’
So if I use the aggregation to build filter dropdowns on the website, I must somehow know that ‘norway’ means ‘Norway’.
I guess I could work around if by doing ‘data.country.name like “norway”’
But I also localize “Norway” to “Norge”. (using my own js structure built from a phrase contenttype)
And again ‘norway’ !== ‘Norway’;
I guess as long as people are involved I should suspect that any content field has inconsistencies in case.
In this instance data.country.name is populated via the content api.
So I could store values in lowercase.
I could also add a config regexp to the TextLine input which only accepts lowercase chars.
There might be future usecases where case sensitivity matters.
It should at least be documented that aggregations are case insensitive and returns lowercase version of whatever was stored.
But really should it not be possible to do case sensitive aggregations?
All indexing and query operations in XP are lowercased. Both storage and query time. For your search example. I.e. ‘data.country.name’ = “norway” or “Norway” will produce the same result.
Hence, the aggregations will always return as lowercase.
So when I want to display a combobox on a web page with the different values which are stored in XP.
How then can I display a human friendly version of the lowercase aggregation bucket key?
I could upcase the first letter of the key. (might be wrong in some languages)
I could upcase the first letter of every word in the key. (might be wrong in some languages)
I could store a “translation” for every lowercase value, of which there might be thousands. (too much work)
I could fetch all content, and process it in js to figure out the human friendly strings. (slow)
I could make another content type, and aggregate on id, and fetch the human friendly version (more code when storing, higher maintenance)
Well, do you want “Norway” and “norway” as different entities when aggregating on user defined tags?
Its a tradeoff between ensuring that you dont need to know the case when searching/aggregating and this issue. We have discussed the possibility to store a raw value also, but its not obvious how to solve every scenario.
Every time I wanted to use aggregations for something, I couldn’t because it all comes out lower case. For example, if you want to make a tag cloud for Java classes then it should look like this:
The values are the aggregations from content in XP.
Thus not unlimited number of items, but varying depending on synced data.
The reason I sync the data instead of using the external API directly is I want a common interface to sort and filter. The part will be used for more than that API. It’s already used for manually added content in XP.
I had a support ticket on this and it was marked as not doable at the moment. With raw I meant how the data was stored, but aggregation returned lowercase.
Funny, I wanted to ask the same question as I currently also have this issue
My use case is the following:
I am working on an headless application in React using graphQL.
My content contains a Tag-Property. So I am workimg on a TagInputcomponent.
In Contentstudio I get the suggestions for tags as entered before (without lowercase!).
I also use term-aggregation to fetch the tags.
How did you implement this in Content-Studio ?? (or how do you fetch the data from repo?)