Thanks for taking a look and the advice. Code is rather lengthy and probably looking at it for too long now.
Gary From: [email protected] [mailto:[email protected]] On Behalf Of Joe Bryan Sent: Monday, February 22, 2016 4:39 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] comparing sequences Hi Gary, I should've tested my assumption; I'm wrong about the bug. While fn:string vs text() is still good advice, this test case shows it's not the problem: let $seq1 := ('a', 'b','c') let $doc := <doc><n>a</n><n>c</n></doc> let $seq2 := $doc/n/text() return distinct-values($seq1[.=$seq2]) Have you confirmed that your cts:search() expression is returning results? I noticed a default element namespace in your second example; that also applies to your cts:search() (which could be problematic, depending on your documents). Sorry for the jumping the gun ;) -jb From: <[email protected]> on behalf of Joe Bryan <[email protected]> Reply-To: MarkLogic Developer Discussion <[email protected]> Date: Monday, February 22, 2016 at 4:24 PM To: MarkLogic Developer Discussion <[email protected]> Subject: Re: [MarkLogic Dev General] comparing sequences Hi Gary, The comparison fails because you're comparing text nodes to strings. Try replacing /text() with /fn:string(). On a more general note, you rarely want to use the text() selector; fn:string() is almost always a better choice: https://developer.marklogic.com/blog/text-is-a-code-smell. Thanks. -jb From: <[email protected]> on behalf of Gary Larsen <[email protected]> Reply-To: MarkLogic Developer Discussion <[email protected]> Date: Monday, February 22, 2016 at 4:21 PM To: 'MarkLogic Developer Discussion' <[email protected]> Subject: Re: [MarkLogic Dev General] comparing sequences My simple test works so it's probably something else I'm not seeing: declare default element namespace "http://developer.envisn.com/xmlns/envisn/netvisn/"; let$seq1 := ('a', 'b','c') let$doc :=<doc><n>a</n><n>c</n></doc> let$seq2 :=$doc/n returndistinct-values($seq1[.=$seq2]) Gary From:[email protected] [mailto:[email protected]] On Behalf Of Gary Larsen Sent: Monday, February 22, 2016 4:13 PM To: 'General MarkLogic Developer Discussion' Subject: [MarkLogic Dev General] comparing sequences Hi, Probably not ML specific but hoping someone can help. I'm having an issue comparing sequence of strings: let $seq1 = ('a','b','c') with the results of a query let $seq2 := cts:search(doc(), $cqf, "unfiltered")/doc/value/text() but this finds no results when it should: let $intersection := distinct-values(seq1 [.=$seq2]) The intersection between two manual sequences works. What am I missing? Thanks, Gary
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
