Make an EMC xDB xQuery XML content search

298 Views Asked by At

I'm new to EMC xDB and I'm trying to understand how it works. I have read some of the documentation, but can't find the answer for my question.

What is the best method for an XML content search?

I can make a xQuery search/operation, but I can't figure out how I make an XML content search?

Let's assume I want to make a xQuery in dir "/test" and want to search if any XML files contains the number "102548458"

1

There are 1 best solutions below

0
Vojtěch Toman On

The answer depends on what you mean by "XML content search" - exact value comparison of full text search? xDB supports both.

For an exact value match ("return all XML documents in the /test library where the /foo/bar" element equals 102548458), you can use a simple XQuery such as follows:

for $x in doc('/test')
where $x/foo/bar = 102548458
return $x

To perform a full-text search ("return all XML documents in the /test library where the /foo/bar" contains text 102548458), you can use the following XQuery Full Text query:

for $x in doc('/test')
where $x/foo/bar contains text '102548458'
return $x