cancel
Showing results for 
Search instead for 
Did you mean: 

Search custom properties of a custom aspect (Simple Search)

biersen
Champ in-the-making
Champ in-the-making
Hi all,

How can I search (on simple search) for custom properties of a custom aspect? I tried this:

mymodel.xml

<namespaces>
   <namespace uri="http://www.myapp.com/model/content/1.0" prefix="myprefix" />
</namespaces>

<types>
   <type name="myprefix:mytype">
      <title>My Type</title>
      <parent>myprefix:mygenerictype</parent>
   <property name="myprefix:mytypeproperty">
         <title>TypeProperty</title>
         <type>d:text</type>
         <protected>false</protected>
         <mandatory>false</mandatory>
         <multiple>false</multiple>
         <index enabled="true">
                        <atomic>false</atomic>
                        <stored>false</stored>
                        <tokenised>true</tokenised>
                     </index>
      </property>
      <mandatory-aspects>
         <aspect>myprefix:myaspect</aspect>            
      </mandatory-aspects>
   </type>
</types>

<aspects>
   <aspect name="myprefix:myaspect">
      <title>My Aspect</title>
      <properties>
         <property name="myprefix:myaspectproperty">
            <title>AspectProperty</title>
            <type>d:text</type>
            <protected>false</protected>
            <mandatory>false</mandatory>
            <multiple>false</multiple>
            <index enabled="true">
                           <atomic>false</atomic>
                           <stored>false</stored>
                           <tokenised>true</tokenised>
                        </index>
         </property>
      </properties>
   </aspect>
</aspects>


web-client-config-custom.xml

<config>
      <client>
         <simple-search-additional-attributes>
            <qname>{http://www.myapp.com/model/content/1.0}mytypeproperty</qname>
                <qname>{http://www.myapp.com/model/content/1.0}myaspectproperty</qname>
                <qname>{http://www.alfresco.org/model/content/1.0}description</qname>
                <qname>{http://www.alfresco.org/model/content/1.0}title</qname>
                <qname>{http://www.alfresco.org/model/content/1.0}author</qname>
         </simple-search-additional-attributes>
      </client>
   </config>

So, when I search (simple search) for title, description and mytypeproperty, the search is ok and I get correct results. But, when I try search for myaspectproperty, the search not work. I tried add  <qname>{http://www.myapp.com/model/content/1.0}myaspect</qname> but I've the same problem.
It is possible to search for custom properties of custom aspects? What i'm doing wrong?
Thank you!


biesen
7 REPLIES 7

sselvan
Champ in-the-making
Champ in-the-making
I believe it has to be like the following for mentioning CustomField for Search ability.

{mycustommodel.model}mycustomfield

kyriakos
Champ in-the-making
Champ in-the-making
Hey guys,

I want the same thing, i created a custom aspects for SHARE that works fine
using these directions
http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/
and now i want to be able to see the results of my custom properties on search, i use 3.3G but any direction would be excellent.
Regards,
Kyriakos

kyriakos
Champ in-the-making
Champ in-the-making
AlfrescFoes Please help !

I made a custom aspect from this
http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/#comme...

Steps
1) kb-model.xml in extension folder

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!– Registration of new models –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/kb-model.xml</value>
            </list>
        </property>
    </bean>

</beans>

2)kb-model.xml in extension folder

<?xml version="1.0" encoding="UTF-8"?>

<!– Definition of new Model –>

<!– The important part here is the name - Note: the use of the my: namespace
     which is defined further on in the document –>
<model name="kb:knowledgebase" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Knowledge Base Model</description>
   <author>Sarris Kyriakos</author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>
   <imports>
        <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace my.new.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="http://www.alfresco.com/model/knowledgebase/1.0" prefix="kb"/>
   </namespaces>

    <aspects>

      <!– Definition of new Content Aspect: Knowledge Base Document –>
      <aspect name="kb:referencable">
         <title>Knowledge Base Referencable</title>
         <properties>
            <property name="kb:documentRef">
               <type>d:text</type>
    <mandatory>true</mandatory>
                 <index enabled="true">
                  <atomic>false</atomic>
                  <stored>true</stored>
                  <tokenised>false</tokenised>
                  </index>
            </property>
         </properties>
      </aspect>

   </aspects>

</model>

3) i configured share-config-custom.xml in web-extension folder

<alfresco-config>

   <!– Document Library config section –>
   <config evaluator="string-compare" condition="DocumentLibrary">

      <!–
         Used by the "Manage Aspects" action

         For custom aspects, remember to also add the relevant i18n string(s)
            cm_myaspect=My Aspect
      –>
      <aspects>
         <!– Aspects that a user can see –>
         <visible>
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:versionable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="kb:referencable" />
         </visible>

         <!– Aspects that a user can add. Same as "visible" if left empty –>
         <addable>
         </addable>

         <!– Aspects that a user can remove. Same as "visible" if left empty –>
         <removeable>
         </removeable>
      </aspects>

   </config>

   <!– cm:content type (existing nodes) –>
   <config  evaluator="node-type" condition="cm:content">
      <forms>
         <!– Default form configuration used on the document details and edit metadata pages –>
         <form>
            <field-visibility>
               <show id="kb:documentRef" />
            </field-visibility>
            <appearance>
               <field id="kb:documentRef" label-id="label.kb_documentRef" />
            </appearance>
         </form>

         <!– Document Library pop-up Edit Metadata form –>
         <form id="doclib-simple-metadata">
            <field-visibility>
               <show id="kb:documentRef" />
            </field-visibility>
            <edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
            <appearance>
               <field id="kb:documentRef" label-id="label.kb_documentRef" />
            </appearance>
         </form>

         <!– Document Library Inline Edit form –>
         <form id="doclib-inline-edit">
            <field-visibility>
               <show id="kb:documentRef" />
            </field-visibility>
            <appearance>
               <field id="kb:documentRef" label-id="label.kb_documentRef" />
            </appearance>
         </form>
      </forms>
   </config>

  
   <config>
         <simple-search-additional-attributes>
                <qname>{http://www.alfresco.com/model/knowledgebase/1.0}documentRef</qname>
         </simple-search-additional-attributes>
   </config>
  
  
</alfresco-config>

4) i create custom-slingshot-application-context.xml in web-extension folder

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.web-extension.messages.knowledgebase</value>
         </list>
      </property>
   </bean>

</beans>

5)I created knowledgebase.properties in messages folder

# Custom knowledge base messages
label.kb_documentRef=KB Reference
kb_referencable=Knowledge Base Referencable

Am i doing something wrong in this, and i can't search the custom property?
Or do i need to configure another file? I am using Alfresco 3.3G ( nightly built ) but any answer from any version is appreciated Smiley Happy

Thanks,
Kyriakos

yanock
Champ in-the-making
Champ in-the-making
Hello,

just a message to up this topic because i can't find the answer. Like everyone i created custom model that works fine but i can't search on my metadata so it's sort of useless. I hope someone know how to do that and share it with me.

Thanks in advance.

yanock
Champ in-the-making
Champ in-the-making
Hello,

helped with this topic i manage to have the search in Explorer work fine.

I let my model and web-client-config-custom.xml if it can help someone :

model :

<?xml version="1.0" encoding="UTF-8"?>

    <!– Definition of new Model –>
    <model name="facture:facturemodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    
      <!– Optional meta-data about the model –>  
      <description>Modele de documents facture</description>
      <author>YL</author>
      <version>1.0</version>
    
      <!– Imports are required to allow references to definitions in other models –>  
      <imports>
        <!– Import Alfresco Dictionary Definitions –>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
      </imports>
    
      <!– Introduction of new namespaces defined by this model –>
      <!– NOTE: The following namespace my.new.model should be changed to reflect your own namespace –>
      <namespaces>
        <namespace uri="facture.model" prefix="facture"/>
      </namespaces>
    
      <types>
        <!– Definition of new Content Type: Documents Facture Type 1 –>
        <type name="facture:TypeFacture">
          <title>Facture</title>
          <parent>cm:content</parent>
          <properties>
           <property name="facture:Societe">
             <type>d:text</type>
           </property>
           <property name="facture:NumFacture">
            <title>Numero de facture</title>
             <type>d:text</type>
           </property>
           <property name="facture:TypeDeFacture">
            <title>Type de facture</title>
             <type>d:text</type>
           </property>
           <property name="facture:DateFacture">
               <title>Date de facture</title>
             <type>d:text</type>
           </property>
           <property name="facture:NumFolio">
               <title>Numero de folio</title>
             <type>d:text</type>
           </property>
           <property name="facture:NumSiren">
               <title>Numero de siren</title>
             <type>d:text</type>
           </property>
           <property name="facture:NumTVA">
               <title>Numero de TVA</title>
             <type>d:text</type>
           </property>
           <property name="facture:NumCommande">
               <title>Numero de commande</title>
             <type>d:text</type>
           </property>
           <property name="facture:MontantTTC">
            <title>Montant TTC</title>
             <type>d:text</type>
           </property>
           <property name="facture:DateCreation">
            <title>Date de creation</title>
             <type>d:text</type>
           </property>
           <property name="facture:NomFournisseur">
            <title>Nom fournisseur</title>
             <type>d:text</type>
           </property>
          </properties>
        </type>    
      </types>
    </model>

web-client.xml

<alfresco-config>

   <!– Example of overriding the from email address –>
   <!–
   <config>
      <client>
         <from-email-address>someone@your-domain.com</from-email-address>
         <search-max-results>100</search-max-results>
      </client>
   </config>
   –>

   <!– Example of adding languages to the list in the login page –>

   <config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="fr_FR">French</language>
      </languages>
   </config>

   <config>
      <client>
         <simple-search-additional-attributes>
            <qname>
               {facture.model}Societe
            </qname>
            <qname>
               {facture.model}NumFacture
            </qname>
            <qname>
               {facture.model}TypeDeFacture
            </qname>
            <qname>
               {facture.model}DateFacture
            </qname>
            <qname>
               {facture.model}NumFolio
            </qname>
            <qname>
               {facture.model}NumSiren
            </qname>
            <qname>
               {facture.model}NumTVA
            </qname>
            <qname>
               {facture.model}NumCommande
            </qname>
            <qname>
               {facture.model}MontantTTC
            </qname>
            <qname>
               {facture.model}DateCreation
            </qname>
            <qname>
               {facture.model}NomFournisseur
            </qname>            
         </simple-search-additional-attributes>
      </client>
   </config>
  
  

      <!– Configuration de l interface entree doc  –>
      <config evaluator="string-compare" condition="Content Wizards">
        <content-types>
          <type name="rh:TypeRH" />
          <type name="societe:TypeSociete" />
          <type name="facture:TypeFacture" />
        </content-types>
      </config>
    
      <!– On rend visible les proprietes –>
      <config evaluator="node-type" condition="rh:TypeRH">
        <property-sheet>
          <show-property name="rh:Dkey" />
          <show-property name="rh:Periode" />
          <show-property name="rh:Matricule" />
          <show-property name="rh:Societe" />
          <show-property name="rh:Etablissement" />
          <show-property name="rh:Uo" />
          <show-property name="rh:Typedoc" />
          <show-property name="rh:Id_lot" />
          <show-property name="rh:Credate" />
          <show-property name="rh:Enregactif" />
        </property-sheet>
      </config>

      <config evaluator="node-type" condition="societe:TypeSociete">
        <property-sheet>
          <show-property name="societe:Dkey" />
          <show-property name="societe:Periode" />
          <show-property name="societe:Societe" />
          <show-property name="societe:Typedoc" />
          <show-property name="societe:Id_lot" />
          <show-property name="societe:Credate" />
          <show-property name="societe:Enregactif" />
        </property-sheet>
      </config>
     
      <config evaluator="node-type" condition="facture:TypeFacture">
        <property-sheet>
          <show-property name="facture:Societe" />
          <show-property name="facture:NumFacture" />
          <show-property name="facture:TypeFacture" />
          <show-property name="facture:DateFacture" />
          <show-property name="facture:NumFolio" />
          <show-property name="facture:NumSiren" />
          <show-property name="facture:NumTVA" />
          <show-property name="facture:NumCommande" />
          <show-property name="facture:MontantTTC" />
          <show-property name="facture:DateCreation" />
          <show-property name="facture:NomFournisseur" />
        </property-sheet>
      </config>


    <!– Rends actif les type dans le wizard "specialise le type –>  
      <config evaluator="string-compare" condition="Action Wizards">
        <specialise-types>
            <type name="rh:TypeRH"/>
            <type name="societe:TypeSociete"/>
            <type name="facture:TypeFacture" />
        </specialise-types>
      </config>

           <!– Example of configuring advanced search –>

           <config evaluator="string-compare" condition="Advanced Search" replace="true">
              <advanced-search>
                 <content-types>
                    <type name="rh:TypeRH"/>
                    <type name="societe:TypeSociete"/>
                    <type name="facture:TypeFacture" />
                 </content-types>
                 <custom-properties>
                
                    <meta-data type="facture:TypeFacture" property="facture:Societe"/>
                     <meta-data type="facture:TypeFacture" property="facture:NumFacture"/>
                     <meta-data type="facture:TypeFacture" property="facture:TypeFacture"/>
                     <meta-data type="facture:TypeFacture" property="facture:DateFacture"/>
                     <meta-data type="facture:TypeFacture" property="facture:NumFolio"/>
                     <meta-data type="facture:TypeFacture" property="facture:NumSiren"/>
                     <meta-data type="facture:TypeFacture" property="facture:NumTVA"/>
                     <meta-data type="facture:TypeFacture" property="facture:NumCommande"/>
                     <meta-data type="facture:TypeFacture" property="facture:MontantTTC"/>
                     <meta-data type="facture:TypeFacture" property="facture:DateCreation"/>
                     <meta-data type="facture:TypeFacture" property="facture:NomFournisseur"/>
                 <!–
                     <meta-data type="rh:TypeRH" property="rh:Dkey"/>
                     <meta-data type="rh:TypeRH" property="rh:Periode" />
                     <meta-data type="rh:TypeRH" property="rh:Matricule" />
                     <meta-data type="rh:TypeRH" property="rh:Societe" />
                     <meta-data type="rh:TypeRH" property="rh:Etablissement" />
                     <meta-data type="rh:TypeRH" property="rh:Uo" />
                     <meta-data type="rh:TypeRH" property="rh:Typedoc" />
                     <meta-data type="rh:TypeRH" property="rh:Id_lot" />
                     <meta-data type="rh:TypeRH" property="rh:Credate" />
                     <meta-data type="rh:TypeRH" property="rh:Enregactif" />
                –>
                </custom-properties>
                
              </advanced-search>
           </config>
   <!– Example of configuring advanced search –>
   <!–
   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
         </content-types>
         <custom-properties>
            <meta-data aspect="app:simpleworkflow" property="app:approveStep" />
         </custom-properties>
      </advanced-search>
   </config>
   –>

   <!– Example of changing the sort direction for a view in the client –>
   <!–
   <config evaluator="string-compare" condition="Views">
      <views>
         <view-defaults>
            <topic>
               <sort-direction>ascending</sort-direction>
            </topic>
         </view-defaults>
      </views>
   </config>
   –>

   <!– Example of adding a custom icon to the Create Space dialog –>
   <!–
   <config evaluator="string-compare" condition="cm:folder icons">
      <icons>
         <icon name="space-icon-custom" path="/images/icons/space-icon-custom.gif" />
      </icons>
   </config>
   –>

   <!– The config below shows how to incorporate the example model–>
   <!– into the web client, for this to work you will need to –>
   <!– rename example-model-context.xml.sample to example-model-context.xml –>
   <!–
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="my:sop" />
      </content-types>
   </config>

   <config evaluator="node-type" condition="my:sop">
      <property-sheet>
         <show-property name="mimetype" display-label-id="content_type"
                        component-generator="MimeTypeSelectorGenerator" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />              
         <show-property name="my:publishedDate" />
         <show-association name="my:signOff" />
         <show-property name="my:authorisedBy" />
         <show-child-association name="my:processSteps" />
      </property-sheet>
   </config>

   <config evaluator="aspect-name" condition="my:imageClassification">
      <property-sheet>
         <show-property name="my:width"/>
         <show-property name="my:height"/>
         <show-property name="my:resolution"/>
      </property-sheet>
   </config>

   <config evaluator="aspect-name" condition="cm:storeSelector">
      <property-sheet>
         <show-property name="cm:storeName" />
      </property-sheet>
   </config>
   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="cm:storeSelector"/>
      </aspects>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="my:imageClassification"/>
      </aspects>
   </config>

   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
            <type name="my:sop" />
         </content-types>
         <custom-properties>
            <meta-data type="my:sop" property="my:authorisedBy" />
            <meta-data aspect="my:imageClassification" property="my:resolution" />
         </custom-properties>
      </advanced-search>
   </config>
   –>

</alfresco-config>


Now i want this search work on share but i have no clues. I modify this 2 document by the Explorer interface : Company Home > Data Dictionary > Models for the model and Company Home > Data Dictionary > Web Client Extension  for the web client. So maybe it doesnt extend the capacities in share. Nevertheless, i can see my metadatas in share.

If someone has an idea now I would be grateful.

rleones
Champ in-the-making
Champ in-the-making
Hi everyone…

I'm not able to search in custom model by WebServices. I've tried everything I could find, but I'm getting no results or getting some kind of error…

Does anyone knows a web page or something like that which exposes the way to find out the content using custom properties by Web Services?

supalucas
Champ in-the-making
Champ in-the-making
Share simple search only searches following default cm properties

names, titles, descriptions, comments, and content

If you wish to add your custom properties into this list, you have to modify the search webscript on the repository tier.