Reputation: 285
I am executing an XQuery search against a word query to return values using co-occurrences. But the problem is that while executing a wild card search, then there are certain false positives that are returned as part of the matching documents. The element word query executed is
cts:element-word-query(fn:QName("", "contents"), "project monitor*",
("case-insensitive","punctuation-insensitive","stemmed","lang=en"), 1)
The query which is executed is
cts:element-value-co-occurrences(xs:QName("node1"), xs:QName("node2"),
("collation=http://marklogic.com/collation/"),
cts:and-query((
cts:element-word-query(fn:QName("", "node3"), "project monitor*", ("case-insensitive","punctuation-insensitive","stemmed","lang=en"), 1),
cts:element-range-query(
xs:QName("node4"),
"=",
xs:long('1234567891011')
),
cts:element-attribute-range-query(
xs:QName("node5"),
xs:QName("attribute1"),
"=",
""
),
cts:collection-query('collection1'),
()
))
)
It is returning two matching results, which has one positive and one has a false positive items.
<cts:co-occurrence>
<cts:value xsi:type="xs:string">General</cts:value>
<cts:value xsi:type="xs:string">/pdf/text-document/12345_0_1234.xml</cts:value>
</cts:co-occurrence>
<cts:co-occurrence>
<cts:value xsi:type="xs:string">Other</cts:value>
<cts:value xsi:type="xs:string">/pdf/text-doc/1234_1_0000.xml</cts:value>
</cts:co-occurrence>
Upvotes: 0
Views: 120
Reputation: 11771
Without a complete reproducible test case, my best guess is that a missing positional index is causing the wildcarded cts:element-word-query
to return the false positive. Try enabling either or both: element word positions
and element value positions
in your database configuration and retry the query (after reindexing).
Upvotes: 3