Hi there,
I have a question about configuring a search service to define additional indexes for document of the custom type.
I have defined new compass files:

mycompass.cfg.xml

<?xml version="1.0"?>
<compass-core-config xmlns="http://www.opensymphony.com/compass/schema/core-config";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.opensymphony.com/compass/schema/core-config http://www.opensymphony.com/compass/schema/compass-core-config.xsd";>
   <compass name="default">
       <connection>
<jdbc managed="true" dialectClass="org.apache.lucene.store.jdbc.dialect.HSQLDialect" deleteMarkDeletedDelta="3600000">
               <dataSourceProvider>
                   <jndi lookup="java:/nxsearch-compass" />
               </dataSourceProvider>
           </jdbc>
       </connection>
<transaction commitBeforeCompletion="true" factory="org.compass.core.transaction.JTASyncTransactionFactory">
           <batchInsertSettings maxBufferedDocs="100" />
       </transaction>
       <converters>
<converter name="date" type="org.compass.core.converter.basic.CalendarConverter" /> <converter name="int" type="org.compass.core.converter.basic.IntConverter">
               <setting name="format" value="#0000000000" />
           </converter>
<converter name="long" type="org.compass.core.converter.basic.LongConverter">
               <setting name="format" value="#00000000000000000000" />
           </converter>
       </converters>
       <mappings>
           <resource location="mydocument.cpm.xml" />
           <resource location="nxdocument.cpm.xml" />
       </mappings>
   </compass>
</compass-core-config>

and mydocument.cpm.xml:

<?xml version="1.0"?>
<!DOCTYPE compass-core-mapping PUBLIC
   "-//Compass/Compass Core Mapping DTD 1.0//EN"
   "http://www.opensymphony.com/compass/dtd/compass-core-mapping.dtd";>
<compass-core-mapping>
<resource alias="mydoc" sub-index="mydocs" analyzer="default" all="false">
       <resource-id name="mydoc_id" />
       <!-- BUILTIN -->
       <resource-property name="ecm:id" store="yes" index="un_tokenized" />
<resource-property name="ecm:qid" store="yes" index="un_tokenized" /> <resource-property name="ecm:name" store="yes" index="un_tokenized" /> <resource-property name="ecm:parentId" store="yes" index="un_tokenized" /> <resource-property name="ecm:primaryType" store="yes" index="un_tokenized" /> <resource-property name="ecm:path" store="yes" index="un_tokenized" /> <resource-property name="ecm:url" store="yes" index="un_tokenized" /> <resource-property name="ecm:currentLifeCycleState" store="yes" index="un_tokenized" /> <resource-property name="ecm:isCheckedInVersion" converter="boolean" store="yes" index="un_tokenized" /> <resource-property name="ecm:versionLabel" store="yes" index="un_tokenized" /> <resource-property name="ecm:repositoryName" store="yes" index="un_tokenized" />
       <!-- DUBLINCORE -->
<resource-property name="dc:title" store="yes" index="un_tokenized" /> <resource-property name="dc:description" converter="date" store="yes" index="un_tokenized" /> <resource-property name="dc:created" converter="date" store="yes" index="un_tokenized" /> <resource-property name="dc:modified" converter="date" store="yes" index="un_tokenized" />
       <!-- UID -->
<resource-property name="uid:uid" store="yes" index="un_tokenized" />
       <!-- MYDOCUMENT -->
<resource-property name="mydoc:priority" store="yes" index="un_tokenized" /> <resource-property name="mydoc:competence" store="yes" index="un_tokenized" /> <resource-property name="mydoc:regions" store="yes" index="un_tokenized" /> <resource-property name="mydoc:author" store="yes" index="un_tokenized" /> <resource-property name="mydoc:content" store="yes" index="un_tokenized" />
   </resource>
</compass-core-mapping>

Is it required to identify builtin resource properties like "ecm:id", "ecm:qid", etc. in the compass mapping file?
Are builtin resource properties indexed by default?

I also defined nx-compass-contrib.xml:

<component name="com.sample.nuxeo.document.search.backend.compass">
<extension target="org.nuxeo.ecm.core.search.service.SearchServiceImpl" point="searchEngineBackend"> <searchEngineBackend name="compass" default="true" class="org.nuxeo.ecm.core.search.backend.compass.CompassBackend"> <configurationFileName>/mycompass.cfg.xml</configurationFileName>
       </searchEngineBackend>
   </extension>
</component>

and nxsearch-contrib.xml:

<component name="com.sample.nuxeo.document.search.service.config">
<extension target="org.nuxeo.ecm.core.search.service.SearchServiceImpl" point="indexableDocType">
       <indexableDocType name="MyDocument">
           <resource>dublincore</resource>
           <resource>myschema</resource>
           <resource>uid</resource>
       </indexableDocType>
   </extension>
<extension target="org.nuxeo.ecm.core.search.service.SearchServiceImpl" point="indexableSchema"> <indexableSchema name="uid" prefix="uid" indexAllFields="true" type="schema"> <field name="uid" analyzer="default" stored="true" indexed="true" type="keyword" binary="false" />
       </indexableSchema>
<indexableSchema name="myschema" prefix="mydoc" indexAllFields="true" type="schema"> <field name="priority" analyzer="default" stored="true" indexed="true" type="keyword" binary="false" /> <field name="competence" analyzer="default" stored="true" indexed="true" type="keyword" binary="false" /> <field name="regions" analyzer="default" stored="true" indexed="true" type="text" binary="false" /> <field name="author" analyzer="default" stored="true" indexed="true" type="text" binary="false" /> <field name="content" analyzer="default" stored="true" indexed="true" type="text" binary="false" />
       </indexableSchema>
   </extension>
<extension target="org.nuxeo.ecm.core.search.service.SearchServiceImpl" point="fullTextField">
       <fullText name="ecm:fulltext" analyzer="default">
           <field>myschema:content</field>
           <mimetype name=".*/.*">any2text</mimetype>
       </fullText>
   </extension>
</component>

With described config files everything works perfectly, but I don't understand what fields I have to declare in the nxsearch-contrib.xml and mycompass.cpm.xml if my document type extends standard document. Is it required to include builtin fields into the nxsearch-contrib.xml and mycompass.cpm.xml? What are difference between "indexableSchema" and "fullTextField" extension points in the nxsearch-contrib.xml and fields which are declared in the mycompass.cpm.xml? Which fields from the first document type should be indexable, if the first document type extends the second document type and for the second type the index service is configured?
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to