Hello,I'm using Alfresco community edition 4.2.c.I created a custom content type with a LIST constraint:
<type name="abc:personaleDocumentazioneVaria">
<title>Personale - Documentazione Varia</title>
<parent>cm:content</parent>
<properties>
<property name="abc:personaleDVCodiceFiscale">
<title>Codice fiscale</title>
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="abc:codicefiscale16_constraint" />
</constraints>
</property>
…
<property name="abc:personaleDVMatricola">
<title>Matricola</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="abc:personaleDVCognome">
<title>Cognome</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="abc:personaleDVNome">
<title>Nome</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="abc:personaleDVDataDocumento">
<title>Data documento</title>
<type>d:date</type>
<mandatory>true</mandatory>
</property>
<property name="abc:personaleDVTiopDocumento">
<title>Tipo documento</title>
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Contratti ed incarichi</value>
<value>Disposizioni di servizio</value>
<value>Documentazione assunzione</value>
<value>Documentazione contabile</value>
<value>Documentazione personale riservata</value>
<value>Documentazione previdenziale</value>
<value>Titoli e formazione</value>
<value>Varie</value>
</list>
</parameter>
<parameter name="caseSensitive">
<value>true</value>
</parameter>
</constraint>
</constraints>
</property>
</properties>
</type>
then, I configured Share advanced search with a "selectmany" control on the property with the LIST constraint (share-config-custom.xml):
<config evaluator="model-type" condition="abc:personaleDocumentazioneVaria">
<forms>
<form id="search">
<field-visibility>
<show id="abc:personaleDVCodiceFiscale" />
<show id="abc:personaleDVMatricola" />
<show id="abc:personaleDVCognome" />
<show id="abc:personaleDVNome" />
<show id="abc:personaleDVDataDocumento" />
<show id="abc:personaleDVTiopDocumento" />
</field-visibility>
<appearance>
<field id="abc:personaleDVDataDocumento">
<control template="/org/alfresco/components/form/controls/daterange.ftl" />
</field>
<field id="abc:personaleDVTiopDocumento">
<control template="/org/alfresco/components/form/controls/selectmany.ftl" >
<control-param name="size">8</control-param>
<control-param name="mode">OR</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
When I search without selecting list elements but only by other properties (for example abc
ersonaleDVNome="Giuliano"), the query is correct, here an example of the query from the log:
((TYPE:"abc:personaleDocumentazioneVaria" AND (abc:personaleDVNome:"Giuliano")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
When I search selecting only one element from the list (for example abc
ersonaleDVNome="Giuliano", abc
ersonaleDVTiopDocumento:"Varie"), the query is correct, here an example of the query from the log:
((TYPE:"abc:personaleDocumentazioneVaria" AND (abc:personaleDVTiopDocumento:"Varie" AND abc:personaleDVNome:"Giuliano")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
But when I search selecting two or more items from the list (for example abc
ersonaleDVNome="Giuliano", abc
ersonaleDVTiopDocumento:"Varie", abc
ersonaleDVTiopDocumento:"Titoli e formazione"), there is a syntax error in the query and the result is wrong, here an example of the query from the log:
((TYPE:"abc:personaleDocumentazioneVaria" AND (((abc:personaleDVTiopDocumento:"Titoli e formazione") OR (abc:personaleDVTiopDocumento:"Varie"))abc:personaleDVNome:"Giuliano")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
The correct query would be:
((TYPE:"abc:personaleDocumentazioneVaria" AND (((abc:personaleDVTiopDocumento:"Titoli e formazione") OR (abc:personaleDVTiopDocumento:"Varie")) AND abc:personaleDVNome:"Giuliano")) AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating") AND NOT ASPECT:"sys:hidden"
Is this a bug? Is there a workaround?Thank you very much in advance.