summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-17 22:32:32 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-17 22:32:32 +0200
commitac20c12603e9d933b14977aa63e0a64a602fcfd1 (patch)
tree9d37cfb908d235445fcb030e7370ceffdb3fd8d3 /searchcommon
parent8d5c7b294bd70f394e68c7f130b64c32afdc1fef (diff)
Add getNamePrefix to get the prefix before any '.'
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributevector.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
index c7993503107..c432606f7f0 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
@@ -71,6 +71,11 @@ public:
**/
virtual const vespalib::string & getName() const = 0;
+ vespalib::stringref getNamePrefix() const {
+ vespalib::stringref name = getName();
+ return name.substr(0, name.find('.'));
+ }
+
/**
* Returns the number of documents stored in this attribute vector.
*