AnsweredAssumed Answered

Booleans and Constraints in Advanced Search

Question asked by riddellg on Sep 21, 2018

I have a custom type that I have configured in share-config-custom.xml for advanced search. I am having problems with two of the field types. 1) boolean  2) a text field which has constraints and some constraint values have spaces in them.


I believe the problem with the constraints field is that it gets sent in the query with extra " characters. If I hard code URLs without the extra quotes it works, but I cannot see how to make the advanced search form do this. For the boolean field I have no idea why it will not work, the objects in the database have got true/false values set but when including the boolean field set to "true" in the search it never succeeds, never get results.


I've seen other posts asking similar questions from a few years ago, reference to Jira tickets opened, so I'm hoping that these issues are known and solvable & I'm just not finding the answer anywhere.  I'm using Alfresco 5.2 Community Edition with the ALfresco 3 SDK All-in-one maven archetype.


My custom content model has a document type defined as follows:


<type name="lsBonds14:baseDocument">

<title>base document</title>



<property name="lsBonds14:docTypeCode">

<title>document type code</title>



<index enabled="true">





<constraint ref="lsBonds14:docTypeCodesOptions"/>



<property name="lsBonds14:purgeDate">

<title>purge date</title>



<index enabled="false">




<property name="lsBonds14:legalHoldIndicator">

<title>legal hold</title>



<index enabled="true">




<property name="lsBonds14:legalHoldCaseRef">

<title>legal hold case ref</title>



<index enabled="true">










with the document type constraints as follows (note the spaces in some values):

<constraint name="lsBonds14:docTypeCodesOptions" type="LIST">

<parameter name="allowedValues">



<!-- Empty for default search-->




<value>DDDD A EEEE</value>

<value>FFFF  GGGG  GGGGG  JJJJJ</value>

<value>KKKK   MMMMM</value>


<value>QQQQ  DE SSSSS</value>






My search form is configured like this in share-config-custom.xml:

<form id="search">


<show id="cm:name"/>

<show id="lsBonds14:docTypeCode" force="true"/>

<show id="lsBonds14:purgeDate" force="true"/>

<show id="lsBonds14:legalHoldIndicator" force="true"/>

<show id="lsBonds14:legalHoldCaseRef" force="true" />






It looks fine, but the queries it is generating look like this and do not get hits on my data. (This is uuencoded in the generated URL, I've decoded it here) -



If I hard code URLs this will work:  "prop_lsBonds14_docTypeCode":"BBBB"

as long as the boolean field is set to empty:   "prop_lsBonds14_legalHoldIndicator":""


Does anyone know the trick to getting booleans to work in Advanced Search?

Does anyone know the trick to getting non-single-word-constraints to work in Advanced Search?