首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >eXist-db - basic Lucene查询返回空序列。

eXist-db - basic Lucene查询返回空序列。
EN

Stack Overflow用户
提问于 2018-11-14 11:50:15
回答 1查看 55关注 0票数 1

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

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

代码语言:javascript
复制
<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 ):

代码语言:javascript
复制
<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>

现在,我对集合中的每个文档中的一个拉丁单词进行多次查询:

代码语言:javascript
复制
let $query := 
   <query>
     <term>vidit</term>
   </query>

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

我收到了回复:

代码语言:javascript
复制
`eXist-db localhost 8081 : Your query returned an empty sequence`

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

在此之前,非常感谢您。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-14 12:50:57

在使用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集合,源集合必须手动重新索引,这样新配置才能活动。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53299588

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档