Mark notinindex-fields
Change-Id: I86e85b38c1512edbe2d821b8718fb4bc52d4ae16
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 20fecbd..43b9ac6 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -106,6 +106,13 @@
"type": "type:attachement",
"value": "data:,This is a reference"
},
+ {
+ "@type": "koral:field",
+ "key": "zz-notinindex",
+ "type": "type:text",
+ "comment": "notinindex",
+ "value": "Stored but not indexed"
+ },
];
@@ -1095,6 +1102,16 @@
expect(mel.children[6].children[0].firstChild.nodeValue).toEqual('z-reference');
expect(mel.children[6].children[1].firstChild.nodeValue).toEqual('This is a reference');
});
+
+ it('should mark metadata not in index', function () {
+ let notInIndexField = Array.from(mel.children).find(function (field) {
+ return field.children[0].firstChild.nodeValue === 'zz-notinindex';
+ });
+
+ expect(notInIndexField).toBeTruthy();
+ expect(notInIndexField.children[1].classList.contains('notinindex')).toBeTruthy();
+ expect(notInIndexField.children[1].firstChild.nodeValue).toEqual('Stored but not indexed');
+ });
diff --git a/dev/js/src/match/corpusByMatch.js b/dev/js/src/match/corpusByMatch.js
index 4b8ec73..d594811 100644
--- a/dev/js/src/match/corpusByMatch.js
+++ b/dev/js/src/match/corpusByMatch.js
@@ -110,7 +110,7 @@
};
// Ignore stored types
- if (type === "type:store" || type === "type:attachement")
+ if (type === "type:store" || type === "type:attachement" || target.classList.contains("notinindex"))
return;
type = type || "type:string";
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 02dfa53..2cec7af 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -63,6 +63,7 @@
let field = fields[posInMetaArray[k]]; // This is the object
let metaL, dt, metaDescr, metaDD, att;
+ const isNotInIndex = field["comment"] === "notinindex";
// Ignore internal IDs
if (k !== "UID" &&
@@ -72,7 +73,7 @@
k !== "layerInfos") {
metaL = document.createElement('div');
-
+
dt = metaL.addE('dt');
dt.addT(k);
dt.setAttribute("title", k);
@@ -80,6 +81,9 @@
metaDescr = field["value"];
metaDD = metaL.addE('dd');
metaDD.setAttribute('data-type', field["type"]);
+ if (isNotInIndex) {
+ metaDD.classList.add("notinindex");
+ };
if(metaDescr instanceof Array){
metaDD.classList.add("metakeyvalues");