Oops, forgot the CC...
-------- Original-Nachricht -------- Betreff: Re: [basex-talk] Full-text search and mixed content - yet another ft question Datum: Thu, 10 May 2012 09:37:05 +0200 Von: Leonard Wörteler leo@woerteler.de An: Manfred Knobloch m.knobloch@iwm-kmrc.de
Dear Manfred,
Am 10.05.2012 09:14, schrieb Manfred Knobloch:
When trying to get the title ('titel') of all nodes that contain a search string 'mag' i get the following:
doc('bilder')/bilder/bild[text() contains text 'mag' ]/titel no result
This query applies the fulltext query to all text nodes directly beneath `bild` elements, which probably isn't what you want to achieve (as no such nodes exists afaict).
doc('bilder')/bilder/bild[. contains text 'mag' ]/titel 18 Hits Query Time about -> 950 ms
This query can't be answered by the fulltext index because the matches could span across text-node borders but the index only indexes individual text nodes. The resulting iterative evaluation causes the slowness.
the following query produces the same result but is much faster ft:search(doc('bilder'),'mag')/ancestor::*[local-name(.) = 'bild']/titel 18 Hits Query Time less than -> 3 ms
this query looks for 'mag' in all text nodes of the database and then ascends to the enclosing `bild` elements, that's answerable via the index. The same could be done by:
doc('bilder')/bilder/bild[ .//text() contains text 'mag' ]/titel
Hope that helps, Cheers, Leo
basex-talk@mailman.uni-konstanz.de