Add "notinindex" to corpus responses
Change-Id: I41ef9253c06010f34dfac282d4bb22e214a4f250
diff --git a/mapper/benchmark_test.go b/mapper/benchmark_test.go
index 289cd8c..71cef1d 100644
--- a/mapper/benchmark_test.go
+++ b/mapper/benchmark_test.go
@@ -167,8 +167,7 @@
opts := MappingOptions{Direction: AtoB}
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
+ for b.Loop() {
_, err := mapper.ApplyResponseMappings("bench-response", opts, responseData)
if err != nil {
b.Fatalf("ApplyResponseMappings failed: %v", err)
@@ -211,8 +210,7 @@
opts := MappingOptions{Direction: true}
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
+ for b.Loop() {
_, err := mapper.ApplyQueryMappings("many-rules", opts, testData)
if err != nil {
b.Fatalf("ApplyQueryMappings failed: %v", err)
diff --git a/mapper/corpus.go b/mapper/corpus.go
index f3f2b0c..18759d6 100644
--- a/mapper/corpus.go
+++ b/mapper/corpus.go
@@ -653,10 +653,11 @@
switch n := node.(type) {
case *parser.CorpusField:
entry := map[string]any{
- "@type": "koral:field",
- "key": n.Key,
- "value": n.Value,
- "mapped": true,
+ "@type": "koral:field",
+ "key": n.Key,
+ "value": n.Value,
+ "mapped": true,
+ "comment": "notinindex",
}
if n.Type != "" {
entry["type"] = "type:" + n.Type
diff --git a/mapper/corpus_test.go b/mapper/corpus_test.go
index 27a1a3c..02964fc 100644
--- a/mapper/corpus_test.go
+++ b/mapper/corpus_test.go
@@ -545,6 +545,7 @@
assert.Equal(t, "textClass", mapped["key"])
assert.Equal(t, "novel", mapped["value"])
assert.Equal(t, true, mapped["mapped"])
+ assert.Equal(t, "notinindex", mapped["comment"])
}
func TestCorpusResponseNoMatch(t *testing.T) {
@@ -593,11 +594,13 @@
assert.Equal(t, "genre", mapped1["key"])
assert.Equal(t, "science", mapped1["value"])
assert.Equal(t, true, mapped1["mapped"])
+ assert.Equal(t, "notinindex", mapped1["comment"])
mapped2 := fields[2].(map[string]any)
assert.Equal(t, "genre", mapped2["key"])
assert.Equal(t, "popsci", mapped2["value"])
assert.Equal(t, true, mapped2["mapped"])
+ assert.Equal(t, "notinindex", mapped2["comment"])
}
func TestCorpusResponseWikiDeReKoFixtureEnrichment(t *testing.T) {