I didn’t look closely at the behavior you are seeing but it sounds like the 
positions aren’t being checked properly so please do file a bug.

One minor correction to the workaround though: You want to use 
cts:element-range-query with the results of cts:value-match not a 
cts:element-value-query. So it would look like this:

xdmp:document-insert("1.xml", 
<doc><email>[email protected]<mailto:[email protected]></email></doc>),
xdmp:document-insert("2.xml", 
<doc><email>[email protected]<mailto:[email protected]></email><email>rob@xxxcom</email></doc>);
cts:search(/, cts:element-range-query(xs:QName("email"), "=", 
cts:value-match(cts:element-reference(xs:QName("email")), 
"*@foo.com<http://foo.com/>")), "unfiltered")

-James

From: <[email protected]> on behalf of "Whitby, Rob" 
<[email protected]>
Reply-To: MarkLogic Developer Discussion <[email protected]>
Date: Wednesday, October 26, 2016 at 7:22 AM
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] wildcard search false positive

Thanks Will, that’s a decent workaround.

I’ll report it as a bug as well.

Cheers
Rob


From: 
<[email protected]<mailto:[email protected]>>
 on behalf of William Sawyer 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Wednesday, 26 October 2016 at 07:01
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] wildcard search false positive

Found if you create a range index on email then you can use cts:value-matches 
to get the matching emails.  If you need the documents that contain those 
emails you can use those values in the search.

xdmp:document-insert("1.xml", 
<doc><email>[email protected]<mailto:[email protected]></email></doc>),
xdmp:document-insert("2.xml", 
<doc><email>[email protected]<mailto:[email protected]></email><email>rob@xxxcom</email></doc>);
cts:search(/, cts:element-value-query(xs:QName("email"), 
cts:value-match(cts:element-reference(xs:QName("email")), 
"*@foo.com<http://foo.com>"), "exact"), "unfiltered")

-Will

On Tue, Oct 25, 2016 at 11:47 PM, William Sawyer 
<[email protected]<mailto:[email protected]>> wrote:
On second thought it seems to be a combination of the two that the indexes 
think its a hit.  If you delete either one it matches correctly.

-Will

On Tue, Oct 25, 2016 at 11:32 PM, William Sawyer 
<[email protected]<mailto:[email protected]>> wrote:
The second document is a hit because of the first email in the document matches 
the query.  For example if you remove the first email from the second document 
then you only get one result.

xdmp:document-insert("1.xml", 
<doc><email>[email protected]<mailto:[email protected]></email></doc>),
xdmp:document-insert("2.xml", <doc><email>rob@xxxcom</email></doc>);
cts:search(/doc, cts:element-value-query(xs:QName("email"), 
"*@foo.com<http://foo.com>", "wildcarded"), "unfiltered")

result:
<doc><email>[email protected]<mailto:[email protected]></email></doc>


-Will

On Mon, Oct 24, 2016 at 12:36 PM, Whitby, Rob 
<[email protected]<mailto:[email protected]>> wrote:

Thanks, I tried on 8.0-6 with no luck.





On 24/10/2016, 16:36, 
"[email protected]<mailto:[email protected]>
 on behalf of Will Thompson" 
<[email protected]<mailto:[email protected]>
 on behalf of [email protected]<mailto:[email protected]>> wrote:



    Hi Rob,



    Are you running the most recent update, 8.0-6? There were some 
wildcard-related bugfixes in that release, including this one: "40053: 
punctuation sensitive wildcarded document matching with cts:element-value-query 
might give incorrect results". It's unclear what exactly that fixes, but it's 
worth a shot.



    -Will





    > On Oct 24, 2016, at 9:18 AM, Whitby, Rob 
<[email protected]<mailto:[email protected]>> wrote:

    >

    > Hi,

    >

    > I’m having trouble getting a preceding-wildcard search to work 
unfiltered. In 2.xml, the presence of the 2nd email ending with "com" 
(rob@xxxcom) makes it a match for the search "*@foo.com<http://foo.com>”.

    >

    > I’ve tried with all the db indexes enabled - is this just not possible to 
resolve accurately without filtering?

    >

    > xdmp:document-insert("1.xml", 
<doc><email>[email protected]<mailto:[email protected]></email></doc>),

    > xdmp:document-insert("2.xml", 
<doc><email>[email protected]<mailto:[email protected]></email><email>rob@xxxcom</email></doc>);

    > cts:search(/, cts:element-value-query(xs:QName("email"), 
"*@foo.com<http://foo.com>", "wildcarded"), "unfiltered")

    >

    >

    >

    > Thanks

    > Rob

    >

    >

    >

    >

    > _______________________________________________

    > General mailing list

    > [email protected]<mailto:[email protected]>

    > Manage your subscription at:

    > http://developer.marklogic.com/mailman/listinfo/general



    _______________________________________________

    General mailing list

    [email protected]<mailto:[email protected]>

    Manage your subscription at:

    http://developer.marklogic.com/mailman/listinfo/general



_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general



_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to