
cts.distinctiveTerms( nodes as Node[], [options as Node?] ) as Object
Return the most "relevant" terms in the model nodes (that is, the terms with the highest scores).
cts.distinctiveTerms( fn.doc("/a.xml").toArray(),
{
score: "logtfidf"
});
=> a cts:class element
cts.distinctiveTerms(
[fn.doc('/shakespeare/plays/hamlet.xml')],
{
"maxTerms":2,
"minVal": 6,
"minWeight": 5,
"score":"logtfidf",
"useDbConfig":false,
"complete":true,
"elementWordPositions":true,
"fastCaseSensitiveSearches":true,
"fastDiacriticSensitiveSearches":true,
"fastElementCharacterSearches":true,
"fastElementPhraseSearches":true,
"fastElementTrailingWildcardSearches":true,
"fastElementWordSearches":true,
"fastPhraseSearches":true,
"fastReverseSearches":true,
"language":"en",
"oneCharacterSearches":false,
"stemmedSearches":"decompounding",
"threeCharacterSearches":false,
"trailingWildcardSearches":false,
"twoCharacterSearches":false,
"wordPositions":true,
"wordSearches":true,
// array form
"elementWordQueryThroughs": ["{http://foobar.com/quux}x",
"i","b"],
// single-element form
"phraseArounds": "div",
"phraseThroughs": "{http://example.com/stoneville}xavier",
"fields":[
{
"fieldName": "dave",
// "includeRoot":true,
"fieldPaths": {
"path":"/root/child/grandchild",
"weight":3
},
"stemmedSearches":true,
"wordSearches":true,
"fastCaseSensitiveSearches":true,
"fastDiacriticSensitiveSearches":true,
"fastPhraseSearches":true,
"trailingWildcardSearches":true,
"trailingWildcardWordPositions":true,
"oneCharacterSearches":true,
"twoCharacterSearches":true,
"threeCharacterSearches":true,
"threeCharacterWordPositions":true,
"wordLexicons":["http://marklogic.com/collation/codepoint"],
"includedElements": {
"qname":"{http://marklogic.com}fish",
"attributeQname":"{http://marklogic.com}bill",
"attributeValue":'13',
"weight":17
},
"excludedElements": [{
"qname":"{http://marklogic.com}pete",
"attributeQname":"{http://marklogic.com}sam",
"attributeValue":'14',
}]
}
],
// single-element form
"rangeElementIndexes": {
"scalarType":"anyURI",
"qname":"{http://example.org/xyzzy}dave",
"collation":"http://marklogic.com/collation/codepoint",
"rangeValuePositions": false,
"invalidValues":"ignore"
},
// array form
"rangeElementAttributeIndexes": [
{
"scalarType": "decimal",
"rangeValuePositions": true,
"parentQname": "{http://marklogic.com/quux}brad",
"qname": "{http://marklogic.com/stoneville}marble"
},
{
"scalarType": "anyURI",
"collation":"http://marklogic.com/collation/",
"rangeValuePositions": true,
"parentQname": "{http://marklogic.com/quux}brad",
"qname": "{http://marklogic.com/stoneville}marble"
},
{
"scalarType": "int",
"rangeValuePositions": true,
"parentQname": "{http://marklogic.com/quux}brad",
"qname": "{http://marklogic.com/stoneville}marble"
}
],
// single-element array
"rangeFieldIndexes": [{
"scalarType":"anyURI",
"fieldName":"{http://example.org/xyzzy}dave",
"collation":"http://marklogic.com/collation/codepoint",
"rangeValuePositions": false,
"invalidValues":"ignore"
}],
}
);
==>
{
"name":"dterms /shakespeare/plays/hamlet.xml",
"offset":0,
"terms":[
{
"id":"17190342381662130619",
"val":825,
"score":1689600,
"confidence":1,
"fitness":0,
"query":{
"wordQuery":{
"text":[
"hamlet"
],
"options":[
"case-insensitive",
"diacritic-insensitive",
"stemmed",
"unwildcarded",
"lang=en"
]
}
}
},
{
"id":"14936670113463358967",
"val":791,
"score":202496,
"confidence":1,
"fitness":1,
"query":{
"elementValueQuery":{
"element":[
"SPEAKER"
],
"text":[
"HAMLET"
],
"options":[
"diacritic-insensitive",
"stemmed",
"unwildcarded",
"lang=en"
]
}
}
}
]
}
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.