Following this tutorial: http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html
I was able to make a custom content model working and i am able to see properties on share view details and edit properties.
Thank you for this great tutorial. It is very helpful.
I wanted my custom properties to search in advance search. I followed the above tutorial and configured advance search option and search form as explained.
I am able to see the properties on advance search page but when i provide the value and search, i get 0 results.
I don't see any errors in my development environment.
Also, one thing i noticed that- search is working for properties "scublished", "sc:isActive" etc.
I have added following properties in addition to what is given in tutorial.
<property name="scublishedBy">
<type>d:text</type>
</property>
<property name="scublishingComment">
<type>d:text</type>
</property>
The values which i have saved for these properties are, values are visible on view details page:
-------------------------------------------------
scublishedBy = Bipin Dixit
scublishingComment = Published this document
-------------------------------------------------
When i submit search from advance search screen by providing the values as mentioned above for the above given properties, i see 0 results.
Can you guide me, if i am missing anything ?
Here is my full content model:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Someco Model</description>
<author>Jeff Potts</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
</namespaces>
<constraints>
<constraint name="sc:campaignList" type="LIST">
<parameter name="allowedValues">
<list>
<value>Application Syndication</value>
<value>Private Event Retailing</value>
<value>Social Shopping</value>
</list>
</parameter>
</constraint>
<constraint name="scwnerList" type="LIST">
<parameter name="allowedValues">
<list>
<value>Smith</value>
<value>Jones</value>
<value>Jacobsen</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<!-- Enterprise-wide generic document type -->
<type name="sc:doc">
<title>Someco Document</title>
<parent>cm:content</parent>
<associations>
<association name="sc:relatedDocuments">
<title>Related Documents</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sc:doc</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>
<type name="sc:whitepaper">
<title>Someco Whitepaper</title>
<parent>sc:doc</parent>
</type>
<type name="sc:marketingDoc">
<title>Someco Marketing Document</title>
<parent>sc:doc</parent>
<properties>
<property name="sc:campaign">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>true</multiple>
<constraints>
<constraint ref="sc:campaignList" />
</constraints>
</property>
<property name="sc:campaignOwner">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>false</multiple>
<constraints>
<constraint ref="scwnerList" />
</constraints>
</property>
</properties>
</type>
<type name="sc:client">
<title>Someco Client</title>
<parent>sys:base</parent>
<properties>
<property name="sc:clientName">
<type>d:text</type>
</property>
<property name="sc:clientId">
<type>d:text</type>
</property>
</properties>
</type>
</types>
<aspects>
<aspect name="sc:webable">
<title>Someco Webable</title>
<properties>
<property name="scublished">
<type>d:date</type>
</property>
<property name="sc:isActive">
<type>d:boolean</type>
<default>false</default>
</property>
<property name="scublishedBy">
<type>d:text</type>
</property>
<property name="scublishingComment">
<type>d:text</type>
</property
</properties>
</aspect>
<aspect name="scroductRelated">
<title>Someco Product Metadata</title>
<properties>
<property name="scroduct">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>true</multiple>
</property>
<property name="sc:version">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>true</multiple>
</property>
</properties>
</aspect>
<aspect name="sc:clientRelated">
<title>Someco Client Related</title>
<associations>
<association name="sc:relatedClients">
<title>Related Clients</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sc:client</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
</aspects>
</model>
MyForm:
<!-- sc:whitepaper type (new nodes) -->
<config evaluator="model-type" condition="sc:whitepaper">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="cm:name" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<show id="mimetype" />
<show id="cm:modified" />
<show id="cm:modifier" />
<!-- scroductRelated -->
<show id="scroduct" />
<show id="sc:version" />
<!-- sc:webable -->
<show id="sc:isActive" />
<show id="scublished" />
<show id="scublishedBy" />
<show id="scublishingComment" />
</field-visibility>
<appearance>
<field id="mimetype">
<control template="/org/alfresco/components/form/controls/mimetype.ftl" />
</field>
<field id="cm:modifier">
<control>
<control-param name="forceEditable">true</control-param>
</control>
</field>
<field id="cm:modified">
<control template="/org/alfresco/components/form/controls/daterange.ftl" />
</field>
<!-- scroductRelated -->
<field id="scroduct" label-id="prop.sc_product">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="sc:version" label-id="prop.sc_version">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<!-- sc:webable -->
<field id="sc:isActive" label-id="prop.sc_isActive">
<control template="/org/alfresco/components/form/controls/checkbox.ftl" />
</field>
<field id="scublished" label-id="prop.sc_published">
<control template="/org/alfresco/components/form/controls/daterange.ftl" />
</field>
<field id="scublishedBy" label-id="Published By">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
<field id="scublishingComment" label-id="Publishing Comment">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Solved! Go to Solution.
Thanks for reading the tutorial, I'm glad you found it helpful.
What you are doing should work. Maybe something is wrong with your SOLR server?
Have you tried going to the SOLR console, selecting the Alfresco core, then going to "Query" and running the search from there?
Enable these logs and see if you can find something:
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
log4j.logger.org.alfresco.solr.query.AbstractQParser=debug
log4j.logger.org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient=debug
As Jeff suggested, check the SOLR console to see if you are able to search the properties or not.
Thanks for reading the tutorial, I'm glad you found it helpful.
What you are doing should work. Maybe something is wrong with your SOLR server?
Have you tried going to the SOLR console, selecting the Alfresco core, then going to "Query" and running the search from there?
Thank you Jeff, i checked solr and alfresco logs and I don't see any errors. Do i need to enable any special logging ?
No i haven't check SOLR console, i will try that as well.
Thanks again for guidance
Enable these logs and see if you can find something:
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
log4j.logger.org.alfresco.solr.query.AbstractQParser=debug
log4j.logger.org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient=debug
As Jeff suggested, check the SOLR console to see if you are able to search the properties or not.
Thanks Jeff and Abhinav. My search is working now. After i added log config, I noticed solr call having value as : Published+this+document for scublishedComment property. Same was the case for Author. When i manually changed the value to "Published this document" and executed on solr admin, it worked.
I also followed some other posts on this forum where some folks had similar issues. I changed the index tokenization config to false and restarted my app.
all good now
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.