AnsweredAssumed Answered

Advanced Search on Custom Type Property with 'OR'

Question asked by b_victor on Apr 30, 2014
Latest reply on May 6, 2014 by b_victor
I am on 4.2.e Community, trying to customize Share advanced search.  I have a custom type, aq:qualityDoc defined, with a property named aq:documentType defined as:

<property name="aq:documentType">
   <title>Document Type</title>
   <type>d:text</type>
      <index enabled="true">
         <atomic>true</atomic>
         <stored>false</stored>
    <tokenised>both</tokenised>
      </index>
   <constraints>
      <constraint ref="aq:documentTypes" />
   </constraints>                
</property>

The associated constraint is defined as:

        <constraint name="aq:documentTypes" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Description</value>
                    <value>Policy</value>
                    <value>Procedure</value>
                    <value>Evidence</value>
                    <value>Form</value>
                    <value>Other</value>
                </list>
            </parameter>
        </constraint>


I have configured advanced search, and the relevant part of my share-config-custom.xml looks like this:

<field id="aq:documentType" label-id="prop.aq_documentType">
   <control template="/org/alfresco/components/form/controls/selectmany.ftl" />
</field>


The form looks like exactly what I want the interface to look like… I can multi-select properties and perform a search from a selectmany control.  I do not get the appropriate results, though.  When there are multiple types selected, the query is translated into a search along the lines of this (obtained from turning up debug):

((TYPE:\"aq:qualityDoc\" AND (aq:documentType:\\\"Policy,Procedure,Form\\\")….


Obviously the above doesn't work, since what I really want is Policy OR Procedure OR Form.  Even when there is only one 'type' selected, I don't end up with any results (which I don't really understand). 

I'm pretty new to Alfresco, so please go easy on me…
1. What do I need to do to get advanced search working the way I want it to? 
2. Why does the query fail when I only have one document type selected (i.e. the query gets translated into something like:
((TYPE:\"aq:qualityDoc\" AND (aq:documentType:\\\"Form\\\"))….

3. Has anyone else seen behavior where when you go back to the "advanced search" dialog after performing a search, and it appears that there are no items selected in the control, but when the query is executed in fact the control has remembered what was previously selected?  Is there a way to ensure that previous selections are 'cleared' prior to resubmitting?

Many thanks for any help / tips provided.
BV

Outcomes