Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a Marklogic database, which has 1000's of XML documents, i am querying for a doc with a nested near queries, but i am

I have a Marklogic database, which has 1000's of XML documents, i am querying for a doc with a nested near queries, but i am getting irrelevant document when i am executing a query in unfiltered mode, but while executing it in a filtered mode the document which i am getting in unfiltered query is not retrieved.

What is the alternate solution for this issue. Note: Shouldn't use filtered query which slows down my execution and overall performance.

Please Answer if are very sure about MARKLOGIC Xquery.

I also tried with re-indexing the database; So don't ask me to re-index which is not working.

My Query:

cts:search(doc(),

cts:near-query(

(cts:word-query("Mostly "),

cts:search(//p,

cts:near-query(

( cts:search(//p,

cts:near-query(

(cts:word-query("Mostly "),

cts:word-query("Shady")),

3)),

cts:search(//p,

cts:near-query(

(cts:word-query("Shady"),

cts:search(//p,

cts:near-query(

(cts:word-query("Americana"),

cts:search(//p,

cts:near-query(

( cts:search(//p,

cts:near-query(

(cts:word-query("Mostly"),

cts:word-query("Shady")),

3)),

cts:search(//p,

cts:near-query(

(cts:word-query("Hepatica"),

cts:search(//p,

cts:near-query(

(cts:word-query("Shady"),

cts:word-query("Mostly")),

1))),

2))),

3))),

7))),

8))),

9))),

5))

I am getting below unrelevant xml document