ft:query-field from within an eXist app

134 Views Asked by At

[Edit: Appears to be this bug]

I would like to use ft:query-field from within an eXist-2.2-based application. While this works just fine when I run the query from an eXide 'new xquery' window or directly using the REST API, I don't get any results as soon as I run this query from within an app.

To be more precise:

I have created an app using eXide's default template.

I have uploaded a collection of TEI files to /db/apps/faust-field-test/data. For that, I have configured a lucene-based index that indexes some of those elements into a fieldtest field:

<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>
            <text qname="tei:l" field="fieldtest"/>
            <text qname="tei:stage" field="fieldtest"/>
            <!-- … -->
        </lucene>
    </index>
</collection>

This works quite fine: if I enter the following into a new eXide tab, I get a bunch of URLs from the collection:

for $hit in ft:query-field('fieldtest', 'pudel')
return document-uri(root($hit))

However, if I copy the exact same query into the app:test template function of the otherwise unmodified app, I get no results:

declare function app:test($node as node(), $model as map(*)) {
    <pre>{
    for $hit in ft:query-field('fieldtest', 'pudel')
    return document-uri(root($hit))
    }</pre>
};

Am I missing something obvious? How can I persuade eXist to have a look into that index?

0

There are 0 best solutions below