On Jul 12, 2007, at 9:45 AM, Sergey Zhemzhitskiy wrote:
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?
No
Are builtin resource properties indexed by default?
Yes
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.
First I'd like to point out that you don't need to duplicate the
provided NXRuntime xml configuration files. Write your own and they
will be taken into account provided that the "name" attribute of the
"component" tag is unique.
That being said, the compass mapping files is to be used for:
- fields that aren't String based (e.g, dates) and require a
conversion.
- text fields that have to go through another analyzer than the
resource-wide one.
Actually, we'd like to get rid of this file and have the Compass
search plugin handle it for you, but that won't happen in the
foreseeable future.
Note also that in case you have inconsistent configuration of
"store", "indexed" and such booleans, the ones from the mappings file
will prevail.
Is it required to include builtin fields into the nxsearch-
contrib.xml and mycompass.cpm.xml?
same rule as above, and this rule is applied in the version of
nxdocument.cpm.xml from thge nuxeo-platform-search-compass-plugin jar
What are difference between "indexableSchema" and "fullTextField"
extension points in the nxsearch-contrib.xml and fields which are
declared in the mycompass.cpm.xml?
fullTextField is an aggregator with attached file transform
capabilities. It is used by the simple search form that you see on
all pages and the ffirst four lines of the adavnaced search form.
This is designed for what users think of "the content of the document".
indexableSchema describes fields corresponding to a Nuxeo Core schema.
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?
Afaik, there is no resolution of extensions being made at this point
which mean that you'd have to declare the indexed schema for first
doc type like this:
<indexableDocType name="FirstDocument">
<resource name="second_schema">
</indexableDocType>
where "second_schema" is a schema declared for second document type,
and therefore available in the first as well.
Of course, you can also use the "indexAllSchemas" attribute and
decide to be happy with it till there is really too much stuff being
indexed.
Hope this helps, and please point us where the documentation is
lacking ;-)
---------
Georges Racinet, Nuxeo SAS
Open Source Enterprise Content Management (ECM)
Web: http://www.nuxeo.com/ and http://www.nuxeo.org/ - Tel: +33 1 40
33 79 87
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm