cancel
Showing results for 
Search instead for 
Did you mean: 

How to add custom type in search suggestion

rasika_g
Champ in-the-making
Champ in-the-making

Hello,

I am using Alfresco Community version 6. I want to ad custom type in live search suggestion.

How can i do that.

Thanks in Advance!

8 REPLIES 8

angelborroy
Community Manager Community Manager
Community Manager

rasika_g
Champ in-the-making
Champ in-the-making

Hi thanks for rply but this is for adding extra information about the results. but in search i need to search a content or folder of my custom type. Currently it is searching only cm:content and cm:folder.

@rasika_g From what i can understand, you want provide custom properties for live search. By default live search looks for keywords in "cm:name cm:title cm:description TEXT TAG". If you have custom properties defined as part of custom types/aspects, then you can configure those as well.

You need to extend the live-search/search webscript, try this and see if it works for your use case. see the details here: 

https://github.com/Alfresco/share/tree/master/share-services/src/main/resources/alfresco/templates/w...

Extend and update live-search-docs.get.config.xml with your custom properties. 

Example:

<search>
   <default-operator>AND</default-operator>
   <default-query-template>%(cm:name cm:title cm:description TEXT TAG demo:publisher demo:author)</default-query-template>
</search>

Extend and update search.get.config.xml with your custom properties. 

Example:

<search>
   <default-operator>AND</default-operator>
   <default-query-template>%(cm:name cm:title cm:description ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT TAG demo:publisher demo:author)</default-query-template>
</search>
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

hi Thanks for replay but it is not working .

I also tried by using https://www.seedim.com.au/customising-alfresco-live-search/ this way but some how it is also not working is there any other way you know.

I am not sure why it is not working for you. Steps are simple to do. Here is a sample project i just tried and it is working as expected.

https://github.com/abhinavmishra14/search-extension-demo

I added a custom property acme:copyrightYear in content model 

Extended live-search and search, see here: https://github.com/abhinavmishra14/search-extension-demo/tree/master/search-extension-demo-platform/...

Added custom property and an additional ootb property in live-search-docs.get.config.xml and search.get.config.xml

live-search-docs.get.config.xml 

<search> <default-operator>AND</default-operator> <default-query-template>%(cm:name cm:title cm:description cm:author acme:copyrightYear 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 cm:author ia:whatEvent ia:descriptionEvent lnk:title lnk:description acme:copyrightYear TEXT TAG)</default-query-template> </search>

Results:

imageacme:copyrightYear = 2020

imageacme:copyrightYear = 2020

imagecm:author = Abhinav

imagecm:author = Abhinav

If your searches are still not working, try checking if documents are getting indexed and searchable

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Hi all,

sorry for the very simple question. But I'm tryng to customize my search modifing

live-search-docs.get.config.xml

but it's not clear to me where I need to put the modified file. Just to be more clear:

Can I put the file somewhere in the tomcat folders or i need to make an amp project?

Thanks for any suggestion

Michele

Its an webscript extension in platform project. It should be placed under for e.g.:

<platform-module>/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.config.xml

Check the example here: 

https://github.com/abhinavmishra14/search-extension-demo/blob/master/search-extension-demo-platform/...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

cesarista
World-Class Innovator
World-Class Innovator

Hi:

You can add TYPE:customtype or ASPECT:customaspect in your live search.

https://docs.alfresco.com/4.0/tasks/rm-search-specialtypes.html

Regards.

--C.