eXist-db-基本的Lucene查询返回空序列 [英] eXist-db - basic Lucene query returns empty sequence

查看:78
本文介绍了eXist-db-基本的Lucene查询返回空序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在eXist-db 4.4中,我尝试实现基本的Lucene查询结构,但未返回任何结果.

In eXist-db 4.4 I am attempting to implement a basic Lucene query structure, but it is returning no results.

/db/apps/deheresi/data中,我有一个tei-xml文档的集合,这些文档具有相同的结构,并且我只想将查询应用于元素tei:seg及其后代中的文本内容.一个典型的示例是:

In /db/apps/deheresi/data I have a collection of tei-xml documents which have the same structure, and I want to apply my query only to the text content found within the element tei:seg and its descendants. A typical sample would be:

<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):

I created and applied a Lucene index as follows (including ignore on certain elements):

<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>

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

I now run my query against a single Latin word found multiple times in every one of my documents in the collection:

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实现难题的一部分?

Am I overlooking a piece of the Lucene implementation puzzle?

非常感谢.

推荐答案

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

When working with eXist indexes, keep in mind that you must store the collection configuration file in a subcollection of /db/system/config/ mirroring the location of the data. So if your data is in /db/apps/deheresi, you must store your collection configuration file as /db/system/config/db/apps/deheresi/collection.xconf.

eXide具有极为方便的功能,该功能可检测何时将集合配置文件存储在数据库中,提供将文件副本存储在/db/system/config子集合内的相应位置以及在复制后重新索引源集合的功能.已存储.

eXide has an extremely convenient feature, which detects when you store a collection configuration file in the database, offers to store a copy of the file in the corresponding location within the /db/system/config subcollection, and reindexes the source collection after the copy is stored.

但是,在eXide以外的地方工作时,请记住必须将对/db/apps/deheresi/collection.xconf的编辑手动复制到/db/system/config集合,并且必须对源集合进行手动重新索引,以使新配置生效.活跃.

However, when working outside eXide, keep in mind that edits to, say, /db/apps/deheresi/collection.xconf must be manually copied to the /db/system/config collection, and the source collection must be manually reindexed—in order for the new configuration to be active.

这篇关于eXist-db-基本的Lucene查询返回空序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆