Hi Evan,

To my knowledge, no.. Except maybe via UDFs.. 
http://docs.marklogic.com/guide/app-dev/aggregateUDFs

cts:values and cts:value-tuples both take queries and options though. And you 
can filter the returned values manually too..

Cheers,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Evan Lenz 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, September 18, 2017 at 10:54 PM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Construct a lexicon value?

I'm wondering if it's possible to construct an artificial lexicon value, i.e. 
that has an associated frequency accessible by the cts:frequency() function.

The use case is a modification of existing code which returns value pairs from 
cts:value-tuples(). I'm only interested in one of the values of each pair (and 
I'm using the proximity option to constrain which tuples come back, which is 
why I can't just use cts:values()). I want to remove duplicate values (that 
appear in more than one pair) and sum their frequencies, so that what I return 
is of the same data type (string + cts:frequency) as before.

I'll probably just construct some XML and update the consuming code 
accordingly, but it would be nice to avoid that more extensive redesign. Maybe 
it's just not good practice to pass lexicon values around while relying on 
their cts:frequency to be accessible, especially since the data type can't be 
properly constrained.

Actually, I now read this in the docs for cts:frequency():

"If the value specified is not from a value lexicon lookup, cts:frequency 
returns a frequency of 0."

So maybe it's not really a different data type, but a hidden property of every 
simple value. I'll rephrase my question: is it possible to set the frequency 
for a value?

Thanks,
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