Hi,
I would like to get a different label for a facet, than the property value returned by default by the Search API.
I'm using the Alfresco Public Rest API Search Service for an ADF application, with facets.
The labels of the facets are returned by the API with the following schema :
"facetsFields": [ { "label": "string", "buckets": [ { "label": "string", "filterQuery": "string", "count": 0, "display": {} } ] } ],
The content of the "label" property is the value of the property in the contentstore by default. There is also a "display" property, which is used for a custom display ("Display name" for users-based buckets for example)
Within the source code, we can see that the "display" field is computed through a PropertyLookupRegistry, that registers custom PropertyLookup for some properties, like for example to return user "displayName" instead of its "username" (PersonPropertyLookup).
I've thus tried to create my custom PropertyLookup for my custom properties, and register it in my module context, by overriding the publicapi.propertyLookups bean.
<bean id="publicapi.myPropertyLookup" class="my.Class">
<property name="supported">
<list>
<value>my:property</value>
</list>
</property>
</bean><bean id="publicapi.propertyLookups" class="org.alfresco.rest.api.lookups.PropertyLookupRegistry">
<property name="lookups">
<list>
<ref bean="publicapi.personPropertyLookup" />
<ref bean="publicapi.mimeTypePropertyLookup" />
<ref bean="publicapi.myPropertyLookup"/>
</list>
</property>
</bean>
The property lookup is correctly loaded, but do not seems to be used by the registry when running a search query through the API (the "display" property is empty...)
Does anyone has already done that ? I am doing something wrong ?
Regards,
Charles
Hi,
Did you manage it to work? I am facing the same problem,
Thanks in advance and best regards!
Hi,
I haven't found a solution, so I had to use another technique (sorry, I can't remember how).
It seems that the source code hasn't change since, so I don't think this problem is solved now.
Regards,
Charles
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.