Не напрямую. Вам придется пройти через все варианты и построить поиск с помощью аспектов и всего самого себя. Это не будет слишком сложно, хотя. Ниже быстрая попытка. Я загрузил существующие параметры поиска через GET /v1/config/query/all?format=json
и выделил несколько аспектов индекса пути. Вот некоторый код, который обходит их и выдает значения фасетов:
'use strict';
const jsearch = require('/MarkLogic/jsearch.sjs');
function reference(c) {
if (c.range) {
if (c.range['path-index']) {
return cts.pathReference(c.range['path-index'].text)
}
}
}
const options = {
"options": {
"constraint": [{
"name": "Auteur",
"range": {
"type": "xs:string",
"facet": true,
"collation": "http://marklogic.com/collation/codepoint",
"facet-option": ["limit=10", "frequency-order", "descending"],
"path-index": {
"text": "*:meta[@name = 'Author']/@content"
}
}
}, {
"name": "ContentType",
"range": {
"type": "xs:string",
"facet": true,
"collation": "http://marklogic.com/collation/codepoint",
"facet-option": ["limit=10", "frequency-order", "descending"],
"path-index": {
"text": "*:meta[@name = 'content-type']/@content"
}
}
}]
}
};
const facets = options.options.constraint.filter(c => c.range);
jsearch.facets(
facets.map(f => {
let ref = reference(f);
if (ref) {
return jsearch.facet(f.name, ref);
}
}).filter(f => f)
).result('iterator');
HTH!