cancel
Showing results for 
Search instead for 
Did you mean: 

search custom properties?

aweber1nj
Champ in-the-making
Champ in-the-making
Newbie question:  I think I saw this referenced somewhere, but I can't locate it now…

Is there a "trick" or additional step that has to be performed after installing a custom content model such that properties designated as "Indexed" will actually be indexed and searchable through the default share "keywords" and "simple searchbox"?

It seems like none of my custom properties are searchable even if I designated them to be indexed in the content model.

Do I have to reset the FT Index somehow so it rebuilds its schema or something like that?

If there's a link that explains it, I will be happy to "RTFM".  Sorry I couldn't locate it myself, so I'm asking here. Smiley Happy

-AJ
1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator
It turns out this has gotten easier in Alfresco 4. The "search template" has been moved to a config file, so you do not have to override the entire search.lib.js file, which is a Good Thing.

So, if you are using Alfresco 4, here are the steps:

1. Copy $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.config.xml to  $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search/search.get.config.xml

2. Edit $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search/search.get.config.xml

3. Add your custom properties to the default-query-template element. For example, suppose I want to add scSmiley Tongueroduct and sc:version to the list of properties that are searched by default. My default-query-template element would look like this:
<search>
   <default-query-template>%(cm:name cm:title cm:description sc:product sc:version ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT TAG)</default-query-template>
</search>

4. Save the file, restart Tomcat, & search!

If you are using a release older than Alfresco 4, the concept is the same, but instead of overriding search.get.config.xml you will override search.lib.js and change the QUERY_TEMPLATES constant.

Jeff

View answer in original post

25 REPLIES 25

kaynezhang
World-Class Innovator
World-Class Innovator

The file can be deployed to the 'extensions' directory ,it will override the out of the box configuration.
so you can place it under following location:
1.${TOMCAT_ROOT}/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search
2.${TOMCAT_ROOT}/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search (make sure ${TOMCAT_ROOT}/shared/classes is in java classpath).

aweber1nj
Champ in-the-making
Champ in-the-making
This worked great, Jeff.

Thank you for the detailed reply.

Does adding "too many" properties to that default search list slow down searches?  While I appreciate Alfresco's ability to restrict the default search criteria, I'm just wondering what the best-practices might be to balance "usability" and performance.

Thanks again!
-AJ

jpotts
World-Class Innovator
World-Class Innovator
I suppose it would at some point–I don't know where that point is. Worth testing out.

Glad you got it working!

Jeff

jpotts
World-Class Innovator
World-Class Innovator
What is this?
2012-08-28 09:29:55,971 WARN [extensions.webscripts.DeclarativeRegistry] [Thread-1] Unable to register script classpath:webscripts/org/springframework/extensions/cmis/content.get.desc.xml due to error: 07280000 Web Script document org/springframework/extensions/cmis/content.get.desc.xml is attempting to define the url '/cmis/content:GET' already defined by org/alfresco/cmis/client/content.get.desc.xml
Did you create that web script in org/springframework/extensions?

Jeff

jpotts
World-Class Innovator
World-Class Innovator
Sorry, I should have been more specific. The error message is complaining about a web script in:
classpath:webscripts/org/springframework/extensions/cmis/content.get.desc.xml

And I'm just wondering where that web script came from. In my installation of 4.0.d, when I browse the web script index by package I see no such web script in that package which makes me think it should not be there. Could it be that you tried to extend some other web script by creating a new web script in that package? You might try moving the entire "cmis" folder under org/springframework/extensions to a backup directory somewhere outside of the Alfresco classpath and restart.

Jeff

jpotts
World-Class Innovator
World-Class Innovator
If you removed that file and you restarted tomcat, you should not be seeing that exact same error message. Can you check to see if that is the case and provide the new error message if you are getting a different one?

Jeff

kevinnason
Champ in-the-making
Champ in-the-making
Hello Jeff, I'm new to the forum and Alfresco. I followed the above instructions on inserting my custom properties into the Search.get.config.xml file and my searches still come up with zero results. Any thoughts

ebuild
Champ on-the-rise
Champ on-the-rise
Do we have to update the xml file inside the alfresco-remote-api-5.0.a-SNAPSHOT.jar or put the pointed folder. I have tried both but results are always empty

mrogers
Star Contributor
Star Contributor
You should *NEVER* update anything inside the webapps folder.   That includes hacking files in some WEB-INF folder.

ebuild
Champ on-the-rise
Champ on-the-rise
<blockquote>You should *NEVER* update anything inside the webapps folder. That includes hacking files in some WEB-INF folder.</blockquote>

So how to add the said custom aspect properties in search
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.