Performance with fulltext searches
Thursday, 24 January 2013 · 3 messages
CD
Charles Duffy24 Jan 2013 01:35 #
Howdy, all --
If I run the following query against a large, full-text-indexed store (output from "svn log --xml" on a repository with several hundred thousand entries), I get results back in well under a second:
count(/log/logentry[./paths/path/text() contains text "trunk"])
However, the following variant takes multiple minutes to execute -- actually, has never yet completed before I've lost patience and cancelled it:
count(/log/logentry[
./paths/path/text() contains text "trunk"
and not(
(./paths/path/text() contains text "tags") or
(./paths/path/text() contains text "branches")
)
])
Is there a way to get reasonable(ish) performance for the more complex query?
LQ
Liam R E Quin24 Jan 2013 01:52 #
Quoted text · Charles Duffy · 7 lines
> count(/log/logentry[ > ./paths/path/text() contains text "trunk" > and not( > (./paths/path/text() contains text "tags") or > (./paths/path/text() contains text "branches") > ) > ])
what about
let $trunk := /log/logentry[
paths/path/text() contains text "trunk"],
$tags := /log/logentry[
paths/path/text() contains text "tags"],
$branches := /log/logentry[
paths/path/text() contains text "branches"]
return $trunk except ($tags|$branches)
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
CG
Christian Grün24 Jan 2013 13:16 #
Liam’s solution should do all you need. You may as well want to try a combination of ftand/ftor:
count(/log/logentry[
paths/path/text() contains text "trunk"
ftand ftnot("tags" ftor "branches")
])
Quoted text · Liam R E Quin · 32 lines
On Thu, Jan 24, 2013 at 12:52 AM, Liam R E Quin <liam at w3.org> wrote: > >> count(/log/logentry[ >> ./paths/path/text() contains text "trunk" >> and not( >> (./paths/path/text() contains text "tags") or >> (./paths/path/text() contains text "branches") >> ) >> ]) > > what about > > let $trunk := /log/logentry[ > paths/path/text() contains text "trunk"], > $tags := /log/logentry[ > paths/path/text() contains text "tags"], > $branches := /log/logentry[ > paths/path/text() contains text "branches"] > > return $trunk except ($tags|$branches) > > > > -- > Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ > Pictures from old books: http://fromoldbooks.org/ > Ankh: irc.sorcery.net irc.gnome.org freenode/#xml > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery