-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On Thu, Aug 14, 2014 at 08:03:39PM +0200, Christian GrĂ¼n wrote:
Hi Chris,
<FTIndexAccess data="edil">
This indicates that the full-text index is indeed used here.
I ran the same query on my laptop in the GUI and got this in the Query Info. I couldn't find the "InfoView" so I hope this helps.
Sorry, I was referring to the query info, which you found anyway..
Compiling:
- pre-evaluating fn:collection("edil")
...
I'm missing the info "applying full-text index..." here, probably because you need to rewrite your code from...
collection($col)//entry where $x//text()[. contains text {$term} using wildcards]
...to...
collection($col)//entry where $x//text() contains text {$term} using wildcards
Could you try this and report about the performance? Christian
Hi Christian,
Thank you very much for your quick reply. Yes, this seems to be much faster and I see "applying full text index".
Compiling: - - pre-evaluating fn:collection("edil") - - simplifying descendant-or-self step(s) - - converting descendant::*:entry to child steps - - simplifying descendant-or-self step(s) - - removing context expression (.) - - applying full-text index - - rewriting where clause(s) Query: declare variable $term as xs:string external := 'athgab.*'; declare variable $col as xs:string external := 'edil'; <results>{subsequence(ft:mark(for $x in collection($col)//entry where $x//text() contains text {$term} using wildcards order by fn:lower-case(fn:replace(($x//orth[1]/text())[1], '\p{P}|\d+','')) collation "?lang=ga" return $x), 1, 5000)}</results> Optimized Query: element results { (fn:subsequence(ft:mark(for $x_0 in ft:search("edil", "athgab.*")/ancestor::*:entry order by fn:lower-case(fn:replace($x_0/descendant-or-self::node()/orth[1]/text()[1], "\p{P}|\d+", "")) empty least collation "http://basex.org/collation?lang=ga" return $x_0), 1, 5000)) } Result: - - Hit(s): 1 Item - - Updated: 0 Items - - Printed: 2048 KB - - Read Locking: global - - Write Locking: none Timing: - - Parsing: 3.32 ms - - Compiling: 32.89 ms - - Evaluating: 1365.49 ms - - Printing: 71.55 ms - - Total Time: 1473.25 ms Query plan: <QueryPlan> <CElem> <QNm value="results" type="xs:QName"/> <FNSeq name="subsequence(items,start[,len])"> <FNFt name="mark(nodes[,tag])"> <GFLWOR> <For> <Var name="$x" id="0"/> <CachedPath> <FTIndexAccess data="edil"> <FTWords> <Str value="athgab.*" type="xs:string"/> </FTWords> </FTIndexAccess> <IterStep axis="ancestor" test="*:entry"/> </CachedPath> </For> <OrderBy> <Key dir="ascending" empty="least"> <FNStr name="lower-case(string)"> <FNPat name="replace(string,pattern,replace[,mod])"> <IterPosFilter> <CachedPath> <VarRef> <Var name="$x" id="0"/> </VarRef> <IterStep axis="descendant-or-self" test="node()"/> <IterPosStep axis="child" test="orth"> <Pos min="1" max="1"/> </IterPosStep> <IterStep axis="child" test="text()"/> </CachedPath> <Pos min="1" max="1"/> </IterPosFilter> <Str value="\p{P}|\d+" type="xs:string"/> <Str value="" type="xs:string"/> </FNPat> </FNStr> </Key> </OrderBy> <VarRef> <Var name="$x" id="0"/> </VarRef> </GFLWOR> </FNFt> <Int value="1" type="xs:integer"/> <Int value="5000" type="xs:integer"/> </FNSeq> </CElem> </QueryPlan>