1

在 eXist-db 4.4 中,我试图实现一个基本的 Lucene 查询结构,但它没有返回任何结果。

/db/apps/deheresi/data我有一组tei-xml具有相同结构的文档,我只想将我的查询应用于元素tei:seg及其后代中找到的文本内容。一个典型的样本是:

<TEI>
 <text>
   [...]
    <seg type="dep_event" subtype="event" xml:id="MS609-0001-1">
           <pb n="1r"/>
           <lb break="n" n="1"/>
           <date type="deposition_date" when="1245-05-27" cert="high">Anno
              Domini M° CC° XL° quinto VI Kalendas Iunii.</date>  
           <persName nymRef="#Arnald_Garnier_MSP-AU" role="dep">Arnaldus Garnerii</persName> 
           testis iuratus dixit quod vidit in 
           <placeName type="event_loc" nymRef="#home_of_Cap-de-Porc">domo 
              <persName nymRef="#Peire_Cap-de-Porc_MSP-AU" role="own">Petri de Sancto Andrea</persName>
           </placeName>
           <lb break="y" n="2"/>
           <persName nymRef="#Bernard_Cap-de-Porc_MSP-AU" role="her">B<supplied reason="expname">ernardum</supplied> de Sancto Andrea</persName>, 
           fratrem dicti Petri, et socium eius, hereticos. Et vidit ibi cum eis dictum
           <persName nymRef="#Peire_Cap-de-Porc_MSP-AU" ana="#uAdo" role="par">P<supplied reason="expname">etrum</supplied> de Sancto Andrea</persName> et 
           <persName nymRef="#Susanna_Cap-de-Porc_MSP-AU" ana="#uAdo" role="par">uxor dicti<lb break="y" n="3"/>Petri</persName>. Et 
           <persName nymRef="#Arnald_Garnier_MSP-AU" ana="#pAdo" role="par"/>ipse
           testis adoravit ibi dictos hereticos, sed non vidit alios adorare. Et 
           <date type="event_date" when="1239">sunt VI anni vel circa</date>. 
           <seg type="inq_int" subtype="specific_question">Et quando ipse testis exivit<lb break="y" n="4"/>domum invenit
                 <persName nymRef="#Guilhem_de_Rosengue_MSP-AU" key="inqint" ana="#pIntra" role="ref">Willelmus de Rozergue</persName> intrantem ad dictos hereticos.</seg>
        </seg>
        <seg>
          [...]
        </seg>
    [...]
  <text>
<TEI>

我创建并应用了如下的 Lucene 索引(包括ignore某些元素):

<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">
    <lucene>
        <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
        <text qname="tei:seg"/>
        <ignore qname="tei:note"/>
        <ignore qname="tei:gap"/>
        <ignore qname="tei:del"/>
        <ignore qname="tei:orig"/>
        <inline qname="tei:supplied"/>
    </lucene>
</index>

现在,我针对集合中的每个文档中多次找到的单个拉丁词运行查询:

let $query := 
   <query>
     <term>vidit</term>
   </query>

return 
    collection('/db/apps/deheresi/data')//tei:seg[ft:query(.,$query)]

我收到了回复:

`eXist-db localhost 8081 : Your query returned an empty sequence`

我是否忽略了 Lucene 实现难题的一部分?

提前谢谢了。

4

1 回答 1

1

使用 eXist 索引时,请记住,您必须将集合配置文件存储在/db/system/config/镜像数据位置的子集合中。因此,如果您的数据在其中/db/apps/deheresi,您必须将您的集合配置文件存储为/db/system/config/db/apps/deheresi/collection.xconf.

eXide 有一个非常方便的功能,当您将集合配置文件存储在数据库中时,它会检测到,提供将文件的副本存储在/db/system/config子集合中的相应位置,并在存储副本后重新索引源集合。

但是,当在 eXide 之外工作时,请记住,/db/apps/deheresi/collection.xconf必须手动将编辑内容复制到/db/system/config集合中,并且必须手动重新索引源集合 - 以便新配置处于活动状态。

于 2018-11-14T12:50:57.857 回答