05-22-2020 03:45 AM
Hi Team,
I have created custom datalist model using below code.
<types> <type name="emp:employeeDetails"> <title>Employee Details</title> <parent>dl:dataListItem</parent> <properties> <property name="emp:empId"> <title>Employee ID</title> <type>d:int</type> <index enabled="true"> <atomic>true</atomic> <stored>false</stored> <tokenised>false</tokenised> <facetable>true</facetable> </index> </property> <property name="emp:firstName"> <title>First Name</title> <type>d:text</type> <index enabled="true"/> </property> </properties> </type> </types>
Added below code in share-config-custom.xml file.
<config evaluator="model-type" condition="emp:employeeDetails"> <forms> <!-- Search form --> <form id="search"> <field-visibility> <show id="emp:firstName" force="true" /> </field-visibility> <appearance> <field id="emp:firstName"> <control template="/org/alfresco/components/form/controls/textfield.ftl" /> </field> </appearance> </form> </forms> </config>
I want to make First Name property as searchable.
Wherever we use cm:title or cm:description property, that value is searchable but search result is not in a user friendly manner.Is there any other configuration required or am i missing something?
Thanks,
Hardik
05-22-2020 04:38 AM
Hi,
You need to override below file with your custom property.
live-search-docs.get.config.xml
<search> <default-operator>AND</default-operator> <default-query-template>% (cm:name cm:title cm:description cu:customprop TEXT TAG) </default-query-template> </search>
search.get.config.xml
<search> <default-operator>AND</default-operator> <default-query-template>% (cm:name cm:title cm:description cu:customprop ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT TAG) </default-query-template> </search>
Replace your property with cu:customprop .
This is working but it displaying result as you posted because datalist item create node and it is assigning nodeid as title and live search trying to display title that's why it is user friendly manner,
05-22-2020 05:19 AM
I have tried and getting the result for custom property also, getting node id as a result.
But for end user, it will be difficult to understand the output and i have more than 50 custom datalists(with unique columns) in the application.
So, is there any way we can view custom property in search result and on click it should redirect to datalist page?
05-22-2020 06:22 AM
You can display your custom property in live search but redirection to datalist is may be difficult because by default it is redirecting to node location.
You need to override SearchBox.js aikau widget to display property.
Alternate way is you can assign any datalist property to title so it looks proper in display.(you need to override datalist item creation webscript)
05-22-2020 04:40 AM
Each entry in the data list creates a node in the back-end.
As the data list is a kind of content model you can search the content through its properties but
the content stored in the repository for the reference only. So when you will search its property it will show the node created in the repository as a search result.
Users are supposed to search the data list entries through the data list UI only.
I don't know whether it will be useful for you or not but there is an add-on available for the filtering of the data list entries.
Check if it is compatible with 5.2.
Explore our Alfresco products with the links below. Use labels to filter content by product module.