Search based on count of particular word
Hi there Below is a sample XML file. ******************************* <Docs> <Doc> <Name>Doc 1</Name> <Info>Hurray</Info> </Doc> <Doc> <Name>Doc 2</Name> <Info>Brinjal is king of vegetables.</Info> </Doc> <Doc> <Name>Doc 3</Name> <Info>Alexandar was a great king. His desire was to conquer the world and rule the world as a king.</Info> </Doc> <Doc> <Name>Doc 4</Name> <Info>I love cherries.</Info> </Doc> <Doc> <Name>Doc 5</Name> <Info>Mango is king of fruits. Alphonso is king of mangoes. So Alphonso is king's king.</Info> </Doc> </Docs> ************************ I want to search the <Info> tag for the word "king" and return the <Name> as output. I know this is simple... :) But the *order of the <Name> should be in order of the word searched (here it will be king) ie the most numbers will come first. * *Doc 5 (3 times king) * *Doc 3 (2 times king) * *Doc 2 (1 time king) * * * -- Have a nice day JBest
Hi John, as your question could be of general interest for XQuery users and developers, I recommend you to rather post it to either talk@x-query.com or Stackoverflow. Best, Christian ___________________________ On Tue, May 21, 2013 at 2:11 PM, John Best <johnbest5673@gmail.com> wrote:
Hi there
Below is a sample XML file.
*******************************
<Docs> <Doc> <Name>Doc 1</Name> <Info>Hurray</Info> </Doc> <Doc> <Name>Doc 2</Name> <Info>Brinjal is king of vegetables.</Info> </Doc> <Doc> <Name>Doc 3</Name> <Info>Alexandar was a great king. His desire was to conquer the world and rule the world as a king.</Info> </Doc> <Doc> <Name>Doc 4</Name> <Info>I love cherries.</Info> </Doc> <Doc> <Name>Doc 5</Name> <Info>Mango is king of fruits. Alphonso is king of mangoes. So Alphonso is king's king.</Info> </Doc> </Docs>
************************
I want to search the <Info> tag for the word "king" and return the <Name> as output. I know this is simple... :)
But the order of the <Name> should be in order of the word searched (here it will be king) ie the most numbers will come first.
Doc 5 (3 times king) Doc 3 (2 times king) Doc 2 (1 time king)
-- Have a nice day JBest
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
participants (2)
-
Christian Grün -
John Best