AnsweredAssumed Answered

Using 'Advanced Search' for searching files in Webproject

Question asked by gjwilson21 on Mar 30, 2009
Hi,
Before posting this message, I did a search on this topic in the forum, but i couldn't get a clear explanation.

Can we use 'Advanced Search' feature, the one in the top right corner of the homepage to search for content in a WebProject(staging sandbox)?

I have added aspects in my customModel.xml file.

==========customeModel.xml=============
<namespaces>
      <namespace uri="custom.model" prefix="custom"/>
      <namespace uri="http://www.alfresco.org/model/content/1.0/pr" prefix="pr"/>
   </namespaces>
   <aspects>
       <aspect name="pr:press_release_metadata">
           <title>Sample Aspect for WCM - Press Release</title>
           <properties>
               <property name="pr:title">
                   <title>MyTitle</title>
                   <type>d:text</type>
                   <index enabled="true">
                   <atomic>false</atomic>
                   <stored>false</stored>
                   <tokenised>true</tokenised></index>
               </property>
               <property name="pr:body">
                   <title>MyBody</title>
                   <type>d:text</type>
                   <index enabled="true" >
                   <atomic>true</atomic>
                   <stored>false</stored>
                   <tokenised>false</tokenised></index>
               </property>
           </properties>
       </aspect>
   </aspects>

And I have added the mapping properties for extracting content from press_release in wcm-xml-metadata-extracter-context.xml

  <bean id="extracter.xml.sample.AlfrescoModelMetadataExtracter"
        class="org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter"
        parent="baseMetadataExtracter"
        init-method="init" >
     <property name="mappingProperties">
      <property name="mappingProperties">
        <!–
           The properties can also be specified using a properties file on the classpath, e.g.:
           <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
              <property name="location">
                 <value>classpath:alfresco/extension/xml-metadata/AlfrescoModel-xpath-mappings.properties</value>
              </property>
           </bean>
        –>
        <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
           <property name="properties">
              <props>
                 <prop key="namespace.prefix.pr">http://www.alfresco.org/model/content/1.0/pr</prop>
                 <prop key="title">pr:title</prop>
                 <prop key="body">pr:body</prop>
              </props>
           </property>
        </bean>
     </property>
     <property name="xpathMappingProperties">
        <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
           <property name="properties">
              <props>
                 <prop key="namespace.prefix.pr">http://www.alfresco.org/model/content/1.0/pr</prop>
                 <prop key="title">/press_release/title</prop>
                 <prop key="body">/press_release/body</prop>
              </props>
           </property>
        </bean>
     </property>
</bean>

<bean
         id="extracter.xml.sample.selector.XPathSelector"
         class="org.alfresco.repo.content.selector.XPathContentWorkerSelector"
         init-method="init">
       <property name="workers">
          <map>
               <entry key="/pr:press_release">
                   <ref bean="extracter.xml.sample.AlfrescoModelMetadataExtracter" />
               </entry>
               <entry key="/press_release">
                   <ref bean="extracter.xml.sample.AlfrescoModelMetadataExtracter" />
               </entry>
           </map>
       </property>
   </bean>

And added an entry in web-client-config-custom.xml to add my metadata properties in advanced search page.

  <config evaluator="string-compare" condition="Advanced Search">
        <advanced-search>
        <custom-properties>
            <meta-data aspect="pr:press_release_metadata" property="pr:title" />
            <meta-data aspect="pr:press_release_metadata" property="pr:body"/>
        </custom-properties>
    </advanced-search>
    </config>

When I looked into the lucene index, the fields are indexed. But a search on 'Advanced Search' Page didn't fetch any file.

Thanks in advance for your help.

Outcomes