summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-04-06 12:55:18 -0700
committerSteve Manuel <nilslice@gmail.com>2017-04-06 12:55:18 -0700
commit338d354222a60fdd4c5e9c9493932f684bae6827 (patch)
treead615d4fd2c5cfa1696344994507d99abcf57bda /system/item
parentf7a1c1afd6a0bf5708530c31da55035322f37ff4 (diff)
adding default implementation of db.Searchable
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/system/item/item.go b/system/item/item.go
index 99d70a8..24ac003 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -7,6 +7,8 @@ import (
"strings"
"unicode"
+ "github.com/blevesearch/bleve"
+ "github.com/blevesearch/bleve/mapping"
uuid "github.com/satori/go.uuid"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"
@@ -208,6 +210,15 @@ func (i Item) AfterReject(res http.ResponseWriter, req *http.Request) error {
return nil
}
+// SearchMapping returns a default implementation of a Bleve IndexMappingImpl
+// partially implements db.Searchable
+func SearchMapping() *mapping.IndexMappingImpl {
+ mapping := bleve.NewIndexMapping()
+ mapping.StoreDynamic = false
+
+ return mapping
+}
+
// Slug returns a URL friendly string from the title of a post item
func Slug(i Identifiable) (string, error) {
// get the name of the post item