Hi Gary,
Thanks for explanation on this and your samples run as you describe. If I
understand correctly cts:element-value-query should not find a match when
using ("punctuation-sensitive")
My query is still returning false matches so hopefully you can see something
wrong.
The cts:search returns 993 rows, but filtering with a predicate finds zero
matches.
<rows>993</rows>
<matches>0</matches>
declare namespace nv='http://developer.envisn.com/xmlns/envisn/netvisn/';
let $match := 'Folders].[Orders].[OrderDate]'
let $cq :=
cts:document-query(cts:uris('',(),cts:and-query((
cts:collection-query('content'),
cts:document-fragment-query(
cts:element-value-query(xs:QName('nv:modelPath'), $match,
('punctuation-sensitive')) )
)) ))
return
(<rows>{fn:count(cts:search(doc(), $cq, 'unfiltered'))}</rows >,
<matches>{let $r := cts:search(doc(), $cq,
'unfiltered')/content/lineage/modelRef/ModelRefImpl
return sum(fn:count($r/modelPath[. = $match]))} </matches>)
Gary
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Gary Vidal
Sent: Wednesday, March 26, 2014 7:24 AM
To: [email protected]
Subject: Re: [MarkLogic Dev General] false match on cts:element-value-query
Gary,
I think the problem is due to the tokenization of the value. If you can
cts:tokenize against the string you will determine which characters are
treated as tokens.
declare namespace html = "http://www.w3.org/1999/xhtml"; let $obj :=
json:object() return (
cts:tokenize("[Folders].[Orders].[OrderDate]") !
map:put($obj,.,xdmp:describe(.)),
$obj
)
Returns
{
"[": "cts:punctuation("[")",
"Folders": "cts:word("Folders")",
"]": "cts:punctuation("]")",
".": "cts:punctuation(".")",
"Orders": "cts:word("Orders")",
"OrderDate": "cts:word("OrderDate")"
}
let $node := <a><p>[Folders].[Orders].[OrderDate]</p></a>
return
cts:contains($node,cts:element-value-query(xs:QName("p"),"Folders.Orders.Ord
erDate",("punctuation-insensitive")))
[returns]
True
let $node := <a><p>[Folders].[Orders].[OrderDate]</p></a>
return
cts:contains($node,cts:element-value-query(xs:QName("p"),"Folders.Orders.Ord
erDate",("punctuation-sensitive")))
[returns]
False
Starting from ML7 you can control the tokenization of string values and how
they are treated
http://docs.marklogic.com/admin:database-tokenizer-override
http://docs.marklogic.com/guide/search-dev/custom-tokenization#id_80979
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general