Hi Christian,

thanks for your help attempt.  I understand that the query is not really simple yet and that it's hard to see what's going on.

Attached is a database document on which you can run the query.

To your questions:

* It does make no difference if the namespace prefixes are replaced with *. Thus you can simplify the query in that manner and the issue persists.
* Yes, the issue does only occur if the code is within the local:search function. If the code is in the global scope of the file, the ft-index is applied. Thus, I cannot simplify the query that way.
* If I replace the functx function with its body, the ft-index is applied. Thus, I cannot simplify the query that way.

I'm happy to help further if I can.

Best,
Sebastian


Am 12.11.2018 um 17:24 schrieb Christian Grün:
Hi Sebastian,

It’s difficult to guess what the query optimizer does by just looking at the query. Could you pass us on a database document that allows us to run the query?

Any attempt to simplify your query is appreciated. Here are some more things that you could try:
• Does it make a difference if you work with namespaces, or could all prefixes in the location steps be replaced with *?
• Does the issue only occur if your code is defined in the local:search function?
• What happens if you replace the functx function call with its body ($value = $seq)?

Best,
Christian



On Mon, Nov 12, 2018 at 9:54 AM Sebastian Zimmer <sebastian.zimmer@uni-koeln.de> wrote:

Hi,

I'm working on a query where the full-text index is not applied, even though it could be (see attached test.xql).

I'm sorry for the somewhat complicated look of the example with data-specific XPaths and so on. I really have tried to simplify it as much as I could, but when I further simplify it, the fulltext index actually will be applied or the query is optimized to () due to cached evaluations.

But if you take the expression of the variable $number and inline it into below where the variable is referenced, you may see what I mean. The result is an equivalent query (see attached test-ft.xql) to the original one, but now the fulltext index *is* applied.

I'm using the BaseX 9.1 snapshot from 2018-11-05.

Best,
Sebastian

--
Sebastian Zimmer
sebastian.zimmer@uni-koeln.de
CCeH Logo

Cologne Center for eHumanities
DH Center at the University of Cologne
Twitter Logo@CCeHum


--
Sebastian Zimmer
sebastian.zimmer@uni-koeln.de
CCeH
              Logo

Cologne Center for eHumanities
DH Center at the University of Cologne
Twitter Logo@CCeHum