Yes, it's tricky because positions are word-based. Proximity 11-13 does what 
you want, but only for this specific case not in the general case, and it 
breaks in the opposite direction at 14.

For a general solution I think you need the indexes to map more closely to your 
group elements. Duplicating the data into additional fragments would be one way 
to do that. Another way might be to think of it as a semantic query problem, 
and model a, b, and c as triples.

-- Mike

On 27 Aug 2013, at 23:54 , "Whitby, Rob" <[email protected]> wrote:

> Hi Gary,
> 
> That would be great, but it doesn't work like that as far as I can tell
> (on 6.0-3.2 at least). The test below doesn't match a2,c2. Or am I missing
> something?
> 
> xdmp:document-insert("groups.xml",
>  <doc>
>    <group>
>      <a>a1</a>
>      <b>b1</b>
>      <c>c1</c>
>    </group>
>    <group>
>      <a>a2</a>
>      <b>b2 with lots of words in to affect the proximity?</b>
>      <c>c2</c>
>    </group>
>    <group>
>      <a>a3</a>
>      <b>b3</b>
>      <c>c3</c>
>    </group>
>  </doc>)
> 
> ;
> 
> declare default collation "http://marklogic.com/collation/codepoint";;
> declare variable $options := ("ordered", "proximity=2");
> 
> for $p in cts:value-tuples((
>  cts:element-reference(xs:QName("a")),
>  cts:element-reference(xs:QName("c"))
>   ), $options, cts:document-query("groups.xml"))
> return fn:string-join(json:array-values($p), ",")
> 
> 
> 
> ==>
> 
> a1,c1
> a3,c3
> 
> 
> 
> 
> 
> 
> 
> 
> On 27/08/2013 18:41, "Gary Vidal" <[email protected]> wrote:
> 
>> Rob,
>> 
>> I believe the proximity in co-occurrence is the distance from one node to
>> another not a word(as stated in documentation).  So if group is always
>> expressed Group (A, B, C, D)
>> 
>> Then the proximity of A->C = 2.  You can confirm this by using
>> cts:value-tuples against a single document passing the promixity.
>> 
>> cts:value-tuples((
>>  cts:element-reference(xs:QName("a")),
>>  cts:element-reference(xs:QName("c"))
>>  ),("proximity=2","ordered")
>> )
>> 
>> 
>> 
>> Gary Vidal
>> Media Consultant
>> MarkLogic Corporation
>> [email protected]
>> Phone: +1 917 576-5794
>> Skype: ml-garyvidal
>> www.marklogic.com
>> 
>> 
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>> 
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 

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

Reply via email to