问题描述
鉴于我的 collection.xconf
中的 Lucene 索引配置
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<fulltext default="none" attributes="false"/>
<lucene>
<analyzer class="org.apache.lucene.analysis.en.EnglishAnalyzer" id="en"/>
<analyzer class="org.apache.lucene.analysis.fr.frenchAnalyzer" id="fr"/>
<text qname="tei:title" index="no">
<field analyzer="en" name="en" if="ancestor-or-self::*/@xml:lang='en'" />
<field analyzer="fr" name="fr" if="ancestor-or-self::*/@xml:lang='fr'" />
</text>
<text qname="tei:div" index="no">
<field analyzer="en" name="en" if="ancestor-or-self::*/@xml:lang='en'" />
<field analyzer="fr" name="fr" if="ancestor-or-self::*/@xml:lang='fr'" />
</text>
</lucene>
</index>
</collection>
如何提高 tei:title
元素的点击率?
我试过了
<text qname="tei:title" index="no" boost="2">
<field analyzer="en" name="en" if="ancestor-or-self::*/@xml:lang='en'" />
<field analyzer="fr" name="fr" if="ancestor-or-self::*/@xml:lang='fr'" />
</text>
还有
<text qname="tei:title" index="no">
<field boost="2" analyzer="en" name="en" if="ancestor-or-self::*/@xml:lang='en'" />
<field boost="2" analyzer="fr" name="fr" if="ancestor-or-self::*/@xml:lang='fr'" />
</text>
但是,虽然前者由于仅对字段进行索引而被忽略,但后者甚至似乎都无效。
解决方法
事实证明这是不可能的,但将来可能会添加。
以下是跟踪进度的功能请求:https://github.com/eXist-db/exist/issues/3874