Am 12.06.2015 um 11:46 schrieb Fabrice Etanchaud:
Gioele, did you check in the execution plan that you query does use
an index ?
>
One way to force the use of the text index could be to start your query with :
db:text('your-collection-name', 'arci')/parent::tei:orth/ and so on.

Hi Fabrice,

first, let me thank you for your suggestion: using `db:text()` drops the query time from 600ms to 2ms!

    declare namespace tei='http://www.tei-c.org/ns/1.0';

    db:text('collection', 'arci')/
      parent::tei:orth
        [ancestor-or-self::*
           [@xml:lang][1]
           [(starts-with(@xml:lang, "san"))]
        ]
      /parent::tei:form/parent::*[self::tei:entry or self::tei:re]

Sadly this will not work for other similar queries that use `[contains(., "text")]` instead of `[. = "text"]`, so I will keep researching more general solutions for the other cases.

Going back to your first question, how can I check that I am in fact using an index for a certain query? I know that the index is enabled, but I am not sure if the query engine is making any use of it.

Regards,

--
Gioele Barabucci <[email protected]>

Reply via email to