I have a huge XML file stored in BaseX. Following is the structure of XML nodes
Datas (Parent Node)
- Data (Child of above)
- Desc (Child of above)
- P (Child of above) and contains the actual text
P
tag contains all the text and I have to count the occurrences of specific word which is
inside the P
tag.
I have created a Full-Text index. Now to count the occurrence of a specific word, I am using following 2 queries
ft:count(doc('BHCR')/Datas/Data/Desc[. contains text 'revolution'])
This query returns 2177 and took 25 sec.
Another one
ft:count(doc('BHCR')/Datas/Data/Desc[text() contains text 'revolution'])
This query returns 3684 and took 52 millisec.
Which one is right? Can anybody explain the difference between these two queries?