Alfresco 分享高级搜索

Posted

技术标签:

【中文标题】Alfresco 分享高级搜索【英文标题】:Alfresco share advanced search 【发布时间】:2015-09-01 07:43:46 【问题描述】:

我有一些问题。我正在创建自定义模型ed:edocuments,其中一方面ed:zagdep 它有一个属性ed:documentRegnum。 我正在自定义高级搜索表单并添加 RegNum 字段,但它不会使用此字段搜索任何内容。 它可以是什么?为什么搜索不起作用?

我的型号代码ed-model.xml (tomcat\shared\classes\alfresco\extension)

<?xml version="1.0" encoding="UTF-8"?>
<model name="ed:edocuments" xmlns="http://www.alfresco.org/model/dictionary/1.0">
      <!-- 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 -->
   <namespaces>
      <namespace uri="http://www.alfresco.com/model/edocuments/1.0" prefix="ed"/>
   </namespaces>
    <aspects>
      <!-- Definition of new Content Aspect: Electronic Document -->
      <aspect name="ed:zagdep">
         <title>Zag Dep</title>
         <properties>
            <property name="ed:documentRegnum">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
   </aspects>
</model>

我的模型上下文文件ed-model-contex.xml (tomcat\shared\classes\alfresco\extension)

<?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.ed.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/ed-model.xml</value>
            </list>
        </property>
    </bean>
</beans>

我的share-config-custom.xml(tomcat\shared\classes\alfresco\web-extension)

<alfresco-config>
   <!-- Document Library config section -->
   <config evaluator="string-compare" condition="DocumentLibrary">
      <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" />
            <aspect name="ed:zagdep" />
         </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="ed:documentRegnum" />               
            </field-visibility>
         </form>
         <!-- Document Library pop-up Edit Metadata form -->
         <form id="doclib-simple-metadata">
            <field-visibility>               
               <show id="ed:documentRegnum" />                
            </field-visibility>
            <edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
         </form>
         <!-- Document Library Inline Edit form -->
         <form id="doclib-inline-edit">
            <field-visibility>    
               <show id="ed:documentRegnum" />               
            </field-visibility>
         </form>
      </forms>
   </config>
    <!-- Advanced search -->
    <config replace="true" evaluator="string-compare" condition="AdvancedSearch">
        <advanced-search>
            <!-- Forms for the advanced search type list -->
            <forms>
                <form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
                <form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form> 
            </forms>
        </advanced-search>
    </config>   
    <config evaluator="model-type" condition="cm:content">
    <forms>
        <!-- Search form -->
        <form id="search">
            <field-visibility>
                <show id="cm:name" />
                <show id="cm:title" force="true" />
                <show id="cm:description" force="true" />               
                <!-- ed:edocuments -->  
                <show id="ed:documentRegnum" />                
            </field-visibility>
            <appearance>
                <!-- ed:edocuments -->
                <field id="ed:documentRegnum" label-id="prop.ed_documentRegnum">
                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                </field>                
            </appearance>
        </form>
    </forms>
</config>
</alfresco-config>

【问题讨论】:

只有一个问题,关于你安装的Alfresco,你说的是Community Edition(版本?) 【参考方案1】:

您只需在基于方面的属性上添加:force="true"。请参见下面的代码。

<show id="ed:documentRegnum" force="true" />

【讨论】:

以上是关于Alfresco 分享高级搜索的主要内容,如果未能解决你的问题,请参考以下文章

能把百度玩出花样的人肯定不简单,分享几个鲜为人知的搜索引擎高级语法

使用 vb.net 的 Web 应用程序的高级搜索页面

快速上手数据挖掘之Solr5搜索引擎高级教程

使用 alfresco search.luceneSearch 或 search.lib.js 使用特定类别名称读取所有文档

Solr5搜索引擎高级教程|Solr5视频

今日头条基础架构高级/资深腾讯高级算法/自然语言/搜索引擎/数据挖掘/数据分析