Skip to content

Commit

Permalink
removed a few more public methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoch committed Aug 30, 2014
1 parent 8c64279 commit 76660c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
10 changes: 3 additions & 7 deletions mapping_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type DocumentMapping struct {
DefaultAnalyzer string `json:"default_analyzer"`
}

func (dm *DocumentMapping) Validate(cache *registry.Cache) error {
func (dm *DocumentMapping) validate(cache *registry.Cache) error {
var err error
if dm.DefaultAnalyzer != "" {
_, err := cache.AnalyzerNamed(dm.DefaultAnalyzer)
Expand All @@ -33,7 +33,7 @@ func (dm *DocumentMapping) Validate(cache *registry.Cache) error {
}
}
for _, property := range dm.Properties {
err = property.Validate(cache)
err = property.validate(cache)
if err != nil {
return err
}
Expand Down Expand Up @@ -62,11 +62,7 @@ func (dm *DocumentMapping) Validate(cache *registry.Cache) error {
return nil
}

func (dm *DocumentMapping) GoString() string {
return fmt.Sprintf(" &bleve.DocumentMapping{Enabled:%t, Dynamic:%t, Properties:%#v, Fields:%#v}", dm.Enabled, dm.Dynamic, dm.Properties, dm.Fields)
}

func (dm *DocumentMapping) DocumentMappingForPath(path string) *DocumentMapping {
func (dm *DocumentMapping) documentMappingForPath(path string) *DocumentMapping {
pathElements := decodePath(path)
current := dm
for _, pathElement := range pathElements {
Expand Down
6 changes: 0 additions & 6 deletions mapping_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
package bleve

import (
"fmt"

"github.com/blevesearch/bleve/document"
)

Expand Down Expand Up @@ -51,7 +49,3 @@ func (fm *FieldMapping) Options() document.IndexingOptions {
}
return rv
}

func (fm *FieldMapping) GoString() string {
return fmt.Sprintf("&bleve.FieldMapping{Name:%s, Type:%s, Analyzer:%s, Store:%t, Index:%t}", *fm.Name, *fm.Type, *fm.Analyzer, *fm.Store, *fm.Index)
}
12 changes: 6 additions & 6 deletions mapping_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ func (im *IndexMapping) validate() error {
if err != nil {
return err
}
err = im.DefaultMapping.Validate(im.cache)
err = im.DefaultMapping.validate(im.cache)
if err != nil {
return err
}
for _, docMapping := range im.TypeMapping {
err = docMapping.Validate(im.cache)
err = docMapping.validate(im.cache)
if err != nil {
return err
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func (im *IndexMapping) mapDocument(doc *document.Document, data interface{}) er
im.walkDocument(data, []string{}, []uint64{}, walkContext)

// see if the _all field was disabled
allMapping := docMapping.DocumentMappingForPath("_all")
allMapping := docMapping.documentMappingForPath("_all")
if allMapping == nil || (allMapping.Enabled != false) {
field := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, walkContext.excludedFromAll, document.INDEX_FIELD|document.INCLUDE_TERM_VECTORS)
doc.AddField(field)
Expand Down Expand Up @@ -270,7 +270,7 @@ func (im *IndexMapping) walkDocument(data interface{}, path []string, indexes []
func (im *IndexMapping) processProperty(property interface{}, path []string, indexes []uint64, context *walkContext) {
pathString := encodePath(path)
// look to see if there is a mapping for this field
subDocMapping := context.dm.DocumentMappingForPath(pathString)
subDocMapping := context.dm.documentMappingForPath(pathString)

// check tos see if we even need to do further processing
if subDocMapping != nil && !subDocMapping.Enabled {
Expand Down Expand Up @@ -403,7 +403,7 @@ func (im *IndexMapping) analyzerNameForPath(path string) string {

// first we look for explicit mapping on the field
for _, docMapping := range im.TypeMapping {
pathMapping := docMapping.DocumentMappingForPath(path)
pathMapping := docMapping.documentMappingForPath(path)
if pathMapping != nil {
if len(pathMapping.Fields) > 0 {
if pathMapping.Fields[0].Analyzer != nil {
Expand Down Expand Up @@ -447,7 +447,7 @@ func (im *IndexMapping) datetimeParserNameForPath(path string) string {

// first we look for explicit mapping on the field
for _, docMapping := range im.TypeMapping {
pathMapping := docMapping.DocumentMappingForPath(path)
pathMapping := docMapping.documentMappingForPath(path)
if pathMapping != nil {
if len(pathMapping.Fields) > 0 {
if pathMapping.Fields[0].Analyzer != nil {
Expand Down

0 comments on commit 76660c0

Please sign in to comment.