cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Search by custom aspect

liao1108
Champ in-the-making
Champ in-the-making
Hi,

I am evaluating Alfresco Community 3 stable for projects. I create a custom aspect with 5 properties that would add to content when file comes into specific space. I can keyin and save data in these properties. But for Advanced Search (with custom aspect added), when I assign aspect properties value and submit, there is nothing back even when the value in search is just the same with content's. But when i search by created time, it does. Two question expecting to your resolve,

1. Anything wrong with my operatin ?
2. How long does search engine take to save the property value into indexing database, before that, Alfresco has no idea to content node added.

Thanks to any help.
Leo
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
Nodes are indexed when they are saved so you should immediately be able to search for and find your documents. Can you cut-and-paste the aspect definition from your model file? Maybe something is funky in there.

Jeff

liao1108
Champ in-the-making
Champ in-the-making
Hi Jeff, Nice to hear from you here. I follow your book and define custom model and web client as followings;

1. Define a new content type in customModel.XML

<types>
     <type name="custom:govdoc">
        <title>公文</title>
        <parent>cm:content</parent>
        <archive>true</archive>
          <properties>
           <property name="custom:year_no">
              <title>年度號</title>
              <type>d:text</type>
              <mandatory>true</mandatory>
           </property>
           <property name="custom:category_no">
              <title>分類號</title>
              <type>d:text</type>
              <mandatory>true</mandatory>
           </property>
           <property name="custom:case_no">
              <title>案次號</title>
              <type>d:text</type>
              <mandatory>true</mandatory>
           </property>
          <property name="custom:book_no">
              <title>卷次號</title>
              <type>d:text</type>
              <mandatory>true</mandatory>
           </property>
            <property name="custom:index_no">
             <title>目次號</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
          </property>
            <property name="custom:doc_no">
             <title>文號</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
          </property>
            <property name="custom:loc_no">
             <title>儲位</title>
            <type>d:text</type>
            <mandatory>false</mandatory>
          </property>

        </properties>
     </type>  
   </types>

2. Define Custom Web Client  in web-client-config-custom.XML
  
<config evaluator="string-compare" condition="Content Wizards">
      <content-types>
          <type name="custom:govdoc"/>
      </content-types>
   </config>

   <config evaluator="node-type" condition="custom:govdoc">
      <property-sheet>
         <separator name="locationSeparator" display-label="公文屬性" component-generator="HeaderSeparatorGenerator"/>
         <show-property name="custom:year_no"/>
         <show-property name="custom:category_no"/>
         <show-property name="custom:case_no"/>
         <show-property name="custom:book_no"/>
         <show-property name="custom:index_no"/>
         <show-property name="custom:doc_no"/>
         <show-property name="custom:loc_no"/>
      </property-sheet>
   </config>

3. Define Custom Advanced Search in web-client-config-custom.XML

   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
        <content-types>
          <type name="custom:govdoc"/>
        </content-types>
         <custom-properties>
            <meta-data type="custom:govdoc" property="custom:year_no" />
            <meta-data type="custom:govdoc" property="custom:category_no" />
            <meta-data type="custom:govdoc" property="custom:case_no" />
            <meta-data type="custom:govdoc" property="custom:book_no" />
            <meta-data type="custom:govdoc" property="custom:index_no" />
            <meta-data type="custom:govdoc" property="custom:doc_no" />
            <meta-data type="custom:govdoc" property="custom:loc_no" />
         </custom-properties>
      </advanced-search>
   </config>

And then, restart Alfresco server, put keywork in Search Box or property field in Adanvce search, Alfresco always ignore then(return nothing). But when I search by created time, the node I create or upload is searchable (it proves search engine is still alive).

Hope You can give me some hint how to solve this problem. Thanks
Leo

jpotts
World-Class Innovator
World-Class Innovator
Here's something to try. Set up your search in the advanced search page, then save the search. Then, go find the saved search using the node browser and look at the search string that got saved. If it looks okay, use the node browser to test it and see what comes back. If it still doesn't work, put the saved search string here so we can look at it.

Jeff

liao1108
Champ in-the-making
Champ in-the-making
I made two searches, search one returns no result, but search two does, their node script are

1. Search on 'loc_no' column that is not mandatory field defined in custom model
<search>
<text></text>
<mode>0</mode>
<categories/>
<content-type>{custom.model}govdoc</content-type>
<folder-type>{http://www.alfresco.org/model/content/1.0}folder</folder-type>

<attributes>
<attribute name="custom:loc_no">1-B-1</attribute>
</attributes>
<ranges/>
<fixed-values/>

<query>
+@\{custom.model\}loc_no:"1-B-1"  AND (( TYPE:"{custom.model}govdoc"   TYPE:"{http://www.alfresco.org/model/content/1.0}folder" ))
</query>
</search>

2. Search on 'doc_no' column that is mandatory field defined in custom model
<search>
<text></text>
<mode>0</mode>
<categories/>
<content-type>{custom.model}govdoc</content-type>
<folder-type>{http://www.alfresco.org/model/content/1.0}folder</folder-type>

<attributes>
<attribute name="custom:doc_no">A000912345</attribute>
</attributes>
<ranges/>
<fixed-values/>

<query>
+@\{custom.model\}doc_no:"A000912345"  AND (( TYPE:"{custom.model}govdoc"   TYPE:"{http://www.alfresco.org/model/content/1.0}folder" ))
</query>
</search>


I made some test then,
1. if 'doc_no' value is '00091234A' or '00091234AB', those two can not be searched, but if it's value is '00091234-AB', it can be found.
2. if 'loc_no' value is '1-F-1', it can not be found. But if the value is '1-FA', it does.

It seems Number value (but i model, it's text, not numberic) is none searchable, even the keywork completely match the value.

The question is, how can I tell search engine to work just like SQL query 'like' ? Thanks for your valuable knowledge.

Leo

liao1108
Champ in-the-making
Champ in-the-making
Hi

If I put index tag in custom model definition as followings

     <index enabled="true">
               <atomic>false</atomic>
               <stored>false</stored>
               <tokenised>false</tokenised>
            </index>

The numeric and string with '-' value can be searched, I guess 'tokenised' means to make filed value into tokens, if not tokenized, the index key would keep as the same with value in field, it then can be searched.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.