Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
realTristan committed Jun 4, 2023
1 parent 98d83f0 commit 98ed684
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nocache/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (ft *FullText) insert(data []map[string]any, minWordLength int) error {
strvNormal string
strv string
)
if _strv := ftFromMap(value); len(_strv) > 0 {
if _strv := WFTGetValueFromMap(value); len(_strv) > 0 {
strv = _strv
strvNormal = _strv
} else {
Expand Down
8 changes: 3 additions & 5 deletions nocache/withft.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nocache

// Get the full-text value from a map
func ftFromMap(value any) string {
func WFTGetValueFromMap(value any) string {
if _, ok := value.(map[string]any); !ok {
return ""
}
Expand All @@ -14,10 +14,8 @@ func ftFromMap(value any) string {

// Verify that the map has the correct keys
if ft, ok := v["$hermes.full_text"]; ok {
if ft, ok := ft.(bool); ok {
if !ft {
return ""
} else if v, ok := v["$hermes.value"]; ok {
if ft, ok := ft.(bool); ok && ft {
if v, ok := v["$hermes.value"]; ok {
if v, ok := v.(string); ok {
return v
}
Expand Down
2 changes: 1 addition & 1 deletion withft.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func WFTGetValue(value any) string {
return ""
}

// ftFromMap is a function that gets the full-text value from a map.
// WFTGetValueFromMap is a function that gets the full-text value from a map.
//
// Parameters:
// - value: any representing the value to get the full-text value from.
Expand Down

0 comments on commit 98ed684

Please sign in to comment.