Search on custom property not returning results
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2014 08:08 PM
I had modified the stock contentModel.xml by adding a custom property "mycustomprop1" to cm:content as follows:
Then I proceeded to add a couple of nodes with FileFolderService, and set the property to "ZACK". But searching for the custom property fails, but if I search for the type I can see the nodes.
What am I missing here? Yes, I am 100% sure I successfully added the "ZACK" property to the nodes, I verified that by reading it back with NodeService.getProperty().
<type name="cm:content"> <title>Content</title> <parent>cm:cmobject</parent> <archive>true</archive> <properties> <property name="cm:content"> <type>d:content</type> <mandatory>false</mandatory> <!– Although content is marked as indexed atomically it may end up asynchronous –> <!– if the content conversion will take too long. Content that does not require conversion –> <!– to UTF8 test/plain will always be indexed atomically –> <index enabled="true"> <atomic>true</atomic> <stored>false</stored> <tokenised>true</tokenised> </index> </property> <property name="cm:mycustomprop1"> <title>My Custom Property</title> <type>d:text</type> <protected>false</protected> <mandatory>false</mandatory> <index enabled="true"> <atomic>true</atomic> <stored>true</stored> <tokenised>true</tokenised> </index> </property> </properties> </type>
Then I proceeded to add a couple of nodes with FileFolderService, and set the property to "ZACK". But searching for the custom property fails, but if I search for the type I can see the nodes.
SearchParameters params = new SearchParameters(); params.addStore(storeRef); params.setLanguage(SearchService.LANGUAGE_LUCENE); params.setQuery("@cm\\:mycustomprop1:\"ZACK\""); /* This returns 0 hits?!? */ //params.setQuery("TYPE:\"cm:content\""); /* This returns the 2 nodes as expected. */ ResultSet results = searchService.query(params);
What am I missing here? Yes, I am 100% sure I successfully added the "ZACK" property to the nodes, I verified that by reading it back with NodeService.getProperty().
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2014 03:04 AM
Hi Heisenberg,
For that, you will have to mention the name of your custom property, i.e "cm:mycustomprop1" in 'search.get.config.xml'.
The mentioned file can be found under file path {server_path}\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\search\search.get.config.xml
In this file, you will see set of properties which are used for searching.
For that, you will have to mention the name of your custom property, i.e "cm:mycustomprop1" in 'search.get.config.xml'.
The mentioned file can be found under file path {server_path}\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\search\search.get.config.xml
In this file, you will see set of properties which are used for searching.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 05:56 PM
Anshu, I'm not using the Alfresco UI, so the webscript template configuration does not apply in my case. I'm interacting with Alfresco NodeService, FileFolderService, and SearchService programmatically, i.e. Java-only through the SDK.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2014 03:49 AM
Hi Heisenberg (or I have to call you Walter White?
)
First of all you have to know that modifing the out of the box contentModel is not a good practice, it's better to use a custom aspect.
However,assuming you know what are you doing, you can try doing a full reindex because of the existing system nodes still apply the old model.
Have you tried to query a standard property like cm:name? Does it work?
Looking at the node browser you can see your property with the correct type and the correct value?
Regards,
Daniele

First of all you have to know that modifing the out of the box contentModel is not a good practice, it's better to use a custom aspect.
However,assuming you know what are you doing, you can try doing a full reindex because of the existing system nodes still apply the old model.
Have you tried to query a standard property like cm:name? Does it work?
Looking at the node browser you can see your property with the correct type and the correct value?
Regards,
Daniele
