Hi all,

It seems like a particular lexicon call should be possible but (apparently
to me) is not. Or maybe I just need to be pointed in the right direction?

I would like to return a list (or map) of co-occurrences, but narrowed to a
particular key value. With a simple values call, I can retrieve values
starting at a particular value and limit the result set like this:

cts:values($my-index, "startValue", "limit=2")

With cts:value-co-occurrences(), I can use the "limit" option, but there is
apparently no way for me to jump to a particular key value in the result
set. This means that I have to fetch the entire list of co-occurrences and
use map:get() on the result. I'm finding that it can be rather slow—in my
case returning over 12,000 co-occurrences when I'm only interested in two
or three of them (the ones having a particular key value). So, in my case,
I already know the key value I'm interested in (just one of them), and I
want to find all the values (of another node) that co-occur with it. The
trick is that I am also using the "proximity" option, so it is not just a
matter of finding all the values in the same fragment. (If it was, I could
just use cts:values() constrained by a range query.)

Do you know if there's a better performing way to do this? I'm using the
proximity option ("proximity=0" to find attribute values on the same
element).

An example might make this more clear.

Let's say I have documents that have content like the following, with a
range index configured for both @index1 and @index2 (both with range value
positions enabled.) The "x" is just a word token that advances the word
position of each element and its attributes:

<foo index1="key1" index2="abc"/>
x
<foo index1="key1" index2="def"/>
x
<foo index1="key2" index2="ghi"/>

I want to get all the index2 values that co-occur with "key1" from all
documents. Because of the above document, I will at least get back "abc"
and "def" (but not "ghi", at least from this document). But I know no way
of doing this without also fetching all the other co-occurrences (including
those for key2) and filtering them out afterwards. Is there another way? If
not, is this a hole in the ML API?

Thanks for any help or ideas you can provide!

Evan

Evan Lenz
President, Lenz Consulting Group, Inc.
http://lenzconsulting.com
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to