From ba201f640c883d5ed2f3e1f68daff3a7ee4c8b9f Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Thu, 6 Apr 2017 17:53:34 -0700 Subject: renaming and add Delete operation for search index --- system/item/item.go | 4 ++-- system/item/types.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'system/item') diff --git a/system/item/item.go b/system/item/item.go index 5babf35..4750ef5 100644 --- a/system/item/item.go +++ b/system/item/item.go @@ -212,11 +212,11 @@ func (i Item) AfterReject(res http.ResponseWriter, req *http.Request) error { // SearchMapping returns a default implementation of a Bleve IndexMappingImpl // partially implements db.Searchable -func (i Item) SearchMapping() *mapping.IndexMappingImpl { +func (i Item) SearchMapping() (*mapping.IndexMappingImpl, error) { mapping := bleve.NewIndexMapping() mapping.StoreDynamic = false - return mapping + return mapping, nil } // Slug returns a URL friendly string from the title of a post item diff --git a/system/item/types.go b/system/item/types.go index bcae58a..dbf13af 100644 --- a/system/item/types.go +++ b/system/item/types.go @@ -26,6 +26,9 @@ var ( // if requested by a valid admin or user ErrAllowHiddenItem = errors.New(`Allow hidden item`) + // ErrNoSearchMapping can be used to tell the system not to create an index mapping + ErrNoSearchMapping = errors.New(`No search mapping for item`) + // Types is a map used to reference a type name to its actual Editable type // mainly for lookups in /admin route based utilities Types map[string]func() interface{} -- cgit v1.2.3