summaryrefslogtreecommitdiff
path: root/system/item/item.go
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2017-04-11 19:51:23 -0700
committerGitHub <noreply@github.com>2017-04-11 19:51:23 -0700
commit3c277a7c41aed0fe3e59fa1ccfd19b48d810b545 (patch)
tree7467eaae0e4ce120529d1984f7a0792a7216d5af /system/item/item.go
parent31ba833f6cf0ac7bce42e8b9b8b44a3020e140b9 (diff)
parent53e6675bc24ff356bc6cc35600fe4e7a8d068996 (diff)
Merge pull request #116 from ponzu-cms/ponzu-dev
[core] Configurable full-text search with Bleve + search API endpoint
Diffstat (limited to 'system/item/item.go')
-rw-r--r--system/item/item.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/system/item/item.go b/system/item/item.go
index 99d70a8..8f392ca 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,21 @@ 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 (i Item) SearchMapping() (*mapping.IndexMappingImpl, error) {
+ mapping := bleve.NewIndexMapping()
+ mapping.StoreDynamic = false
+
+ return mapping, nil
+}
+
+// IndexContent determines if a type should be indexed for searching
+// partially implements db.Searchable
+func (i Item) IndexContent() bool {
+ return false
+}
+
// 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