summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-09-10 15:40:15 +0200
committerTor Egge <Tor.Egge@online.no>2022-09-10 15:40:15 +0200
commit6606938ef28082ca9211b680d49af8eff0af95e5 (patch)
treee659a31fd70e52ec8006325db49afba933a87384 /searchlib
parent17ed5acbf5c03be795dd1700f5afbf3cbcac0aa0 (diff)
Avoid multiple definitions of juniper::QueryItem.
Use single definition of ItemCreator enumeration in C++.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/item_creator.h20
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/parse.h12
2 files changed, 23 insertions, 9 deletions
diff --git a/searchlib/src/vespa/searchlib/parsequery/item_creator.h b/searchlib/src/vespa/searchlib/parsequery/item_creator.h
new file mode 100644
index 00000000000..99d8722ea95
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/parsequery/item_creator.h
@@ -0,0 +1,20 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+namespace search::parseitem {
+
+/** A tag identifying the origin of a query node.
+ * Note that descendants may originate from elsewhere.
+ * Used in search::ParseItem and in Juniper.
+ * If changes necessary:
+ * NB! Append at end of list - corresponding type used in search
+ * container and updates of these two types must be synchronized.
+ * (container-search/src/main/java/com/yahoo/prelude/query/Item.java)
+ */
+enum class ItemCreator {
+ CREA_ORIG = 0, // Original user query
+ CREA_FILTER // Automatically applied filter (no specific type)
+};
+
+}
diff --git a/searchlib/src/vespa/searchlib/parsequery/parse.h b/searchlib/src/vespa/searchlib/parsequery/parse.h
index 1285125d34b..d7a04280738 100644
--- a/searchlib/src/vespa/searchlib/parsequery/parse.h
+++ b/searchlib/src/vespa/searchlib/parsequery/parse.h
@@ -2,6 +2,7 @@
#pragma once
+#include "item_creator.h"
#include <vespa/searchlib/query/weight.h>
#include <vespa/vespalib/stllike/string.h>
@@ -23,7 +24,7 @@ class ParseItem
{
public:
/** The type of the item is from this set of values.
- It is important that these defines match those in prelude/source/com/yahoo/prelude/query/Item.java */
+ It is important that these defines match those in container-search/src/main/java/com/yahoo/prelude/query/Item.java */
enum ItemType {
ITEM_OR = 0,
ITEM_AND = 1,
@@ -62,15 +63,8 @@ public:
};
/** A tag identifying the origin of this query node.
- * Note that descendants may originate from elsewhere.
- * If changes necessary:
- * NB! Append at end of list - corresponding type
- * used in Juniper and updates of these two types must be synchronized.
- * (juniper/src/query.h)
*/
- enum ItemCreator {
- CREA_ORIG = 0 // Original user query
- };
+ using ItemCreator = parseitem::ItemCreator;
enum ItemFeatures {
IF_WEIGHT = 0x20, // item has rank weight