<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create a custom property property lookup for REST API Search in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73606#M23687</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get a different label for a facet, than the property value returned by default by the Search API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the &lt;A href="https://api-explorer.alfresco.com/api-explorer/#!/search/search" rel="nofollow noopener noreferrer"&gt;Alfresco Public Rest API Search Service&lt;/A&gt; for an ADF application, with facets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The labels of the facets are returned by the API with the following schema :&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px 0px 3px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: 1.4em; font-family: inherit; vertical-align: baseline; color: #333333;"&gt;&lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1em; line-height: 1.5em; font-family: 'Droid Sans', sans-serif; vertical-align: baseline;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;"&gt;&lt;DIV style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;"&gt;&lt;DIV style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;"&gt;&lt;DIV class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; clear: both;"&gt;&lt;DIV class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; display: block;"&gt;&lt;PRE style="margin: 5px 0px 0px; padding: 5px; border: 1px solid #e5e0c6; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 0.85em; line-height: 1.2em; font-family: 'Anonymous Pro', Menlo, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', monospace; vertical-align: baseline; background-color: #ffffdd; overflow: auto; max-height: 200px; cursor: pointer;"&gt;&lt;CODE class="" style="margin: 0px; padding: 0.5em; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: 1.6em; font-family: inherit; vertical-align: baseline; display: block; background: none; color: black;"&gt;&lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;"&gt;"facetsFields": [         {           "label": &lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: #880000;"&gt;"string"&lt;/SPAN&gt;,           "buckets": [             {               &lt;STRONG&gt;"label": &lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px none; font-style: inherit; font-variant: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; font-size-adjust: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-language-override: inherit; font-feature-settings: inherit; font-variation-settings: inherit; vertical-align: baseline; color: #880000;"&gt;"string"&lt;/SPAN&gt;,&lt;/STRONG&gt;              "filterQuery": &lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: #880000;"&gt;"string"&lt;/SPAN&gt;,               "count": &lt;SPAN class="" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: #008800;"&gt;0&lt;/SPAN&gt;,               "display": {}             }           ]         }       ],&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The content of the "label" property is&amp;nbsp; 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)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within &lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/rest/api/search/impl/ResultMapper.java#L457" rel="nofollow noopener noreferrer"&gt;the source code&lt;/A&gt;, we can see that the "display" field is computed through a &lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/rest/api/lookups/PropertyLookupRegistry.java" rel="nofollow noopener noreferrer"&gt;PropertyLookupRegistry&lt;/A&gt;, that registers custom PropertyLookup for some properties, like for example to return user "displayName" instead of its "username" (&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/rest/api/lookups/PersonPropertyLookup.java" rel="nofollow noopener noreferrer"&gt;&lt;SPAN class=""&gt;PersonPropertyLookup&lt;/SPAN&gt;&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've thus tried to create my custom PropertyLookup for my custom properties, and register it in my module context, by overriding the &lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/public-rest-context.xml#L833" rel="nofollow noopener noreferrer"&gt;publicapi.propertyLookups&lt;/A&gt; bean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="background-color: #212121; color: #eeffff; font-family: 'Fira Code'; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;bean &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="publicapi.myPropertyLookup" &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="my.Class"&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;property &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="supported"&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;list&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;/SPAN&gt;my:property&lt;SPAN style="color: #89ddff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;list&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;property&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;bean&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;PRE style="background-color: #212121; color: #eeffff; font-family: 'Fira Code'; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;bean &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="publicapi.propertyLookups" &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="org.alfresco.rest.api.lookups.PropertyLookupRegistry"&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;property &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;name&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="lookups"&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;list&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;ref &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;bean&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="publicapi.personPropertyLookup" &lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;/&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;ref &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;bean&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;="publicapi.mimeTypePropertyLookup" &lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;/&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;ref &lt;/SPAN&gt;&lt;SPAN style="color: #ffcb6b; font-style: italic;"&gt;bean&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d; "&gt;="&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;publicapi.myPropertyLookup&lt;/SPAN&gt;&lt;SPAN style="color: #c3e88d;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;/&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;list&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;property&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: #f07178;"&gt;bean&lt;/SPAN&gt;&lt;SPAN style="color: #89ddff;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone has already done that ? I am doing something wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Apr 2019 09:46:25 GMT</pubDate>
    <dc:creator>amoae</dc:creator>
    <dc:date>2019-04-12T09:46:25Z</dc:date>
    <item>
      <title>Create a custom property property lookup for REST API Search</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73606#M23687</link>
      <description>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": [</description>
      <pubDate>Fri, 12 Apr 2019 09:46:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73606#M23687</guid>
      <dc:creator>amoae</dc:creator>
      <dc:date>2019-04-12T09:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create a custom property property lookup for REST API Search</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73607#M23688</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Did you manage it to work? I am facing the same problem,&lt;/P&gt;&lt;P&gt;Thanks in advance and best regards!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 15:41:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73607#M23688</guid>
      <dc:creator>ceeliro</dc:creator>
      <dc:date>2021-01-04T15:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create a custom property property lookup for REST API Search</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73608#M23689</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I haven't found a solution, so I had to use another technique (sorry, I can't remember how). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It seems that the source code hasn't change since, so I don't think this problem is solved now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 15:40:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-a-custom-property-property-lookup-for-rest-api-search/m-p/73608#M23689</guid>
      <dc:creator>amoae</dc:creator>
      <dc:date>2021-01-05T15:40:16Z</dc:date>
    </item>
  </channel>
</rss>

