Selective Indexing: Do I need to make sure queries only use the indexed elements?

Tuesday, 19 July 2016 · 2 messages
MG
Maximilian Gärber19 Jul 2016 18:51 #
Hi, especially with the FTINDEX, say I indexed all <Foo> elements with a fulltext query that asks for any elments, e.g. //*[text() contains text { 'bar', 'baz' } any] would this only use the <Foo> elements or traverse all other elments (without index) as well? How about ft:search("DB", "bar") - would this behave differently? Regards, Max
CG
Christian Grün19 Jul 2016 18:55 #
Hi Max,
Quoted text · Maximilian Gärber · 4 lines
> especially with the FTINDEX, say I indexed all <Foo> elements with a > fulltext query that asks for any elments, e.g. > > //*[text() contains text { 'bar', 'baz' } any]
Queries of this type will be evaluated by sequential scans, because all nodes need to be accessed anyway. You can check the query info to see if the index will be utilized.
Quoted text · Maximilian Gärber · 1 line
> How about ft:search("DB", "bar") - would this behave differently?
This one will only give you results from the index (The documentation says: »Returns all text nodes from the full-text index of the database $db that contain the specified $terms.«). Hope this helps Christian

⚡Generated with XQuery