Hi Dirk,
Thanks for your reply.. What will be the query for the following structure -
I tried your yesterday's query it achieved the result as required. My structure was not exactly the same as mentioned yesterday. I thought, I would modify it as per my structure. But, I was not successful. Below is my complete structure.
I want to search the MainDesc, which have 2 child nodes viz; shortDesc and longDesc.
<Docs> <Doc> <DocTitle C="1"></DocTitle> <MainDesc> <shortDesc></shortDesc> <longDesc> some text <B>to make the word(s) bold Optional</B> some text <I>to make the word(s) italic Optional</I> some text <U>to have an underline Optional</U> some text some text </longDesc> </MainDesc> <FullDesc></FullDesc> </Doc> </Docs>
-------------------------------------------------------------------------
Hello John,
I guess your second query isn't really doing what you intend it to do. Actually, it will yield the same output as your first query (the child step /MainDesc will only have the effect that fragments without MainDesc as a child will be filtered out). I guess the following query should work (at least if I understood correctly what you are trying to achieve):
for $x in ft:search("docMaster", ("emf","waves"), map{'mode':='all words'})/parent::*:MainDesc/ parent::*:Doc return $x/DocTitle/text()
Thereby, you using the parent step you assure that the found text node was actually inside a MainDesc node.
Please also note that there is a difference between an ancestor step and a parent step and as you seem to know your structure it might be easier and faster to simply use parent.
Cheers, Dirk