smgutils

package
v0.0.0-...-a4a9cab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bigram

func Bigram(str string) []string

Bigram returns bigram string.

func BigramForSearch

func BigramForSearch(str string) (string, error)

BigramForSearch returns bigram string for Document field.

func Sanitize

func Sanitize(value string) string

Sanitize about Search API query.

func StringPropQuery

func StringPropQuery(propName string, value string) string

StringPropQuery returns ngram match query string.

func Unigram

func Unigram(str string) []string

Unigram returns unigram string.

func UnigramForSearch

func UnigramForSearch(str string) (string, error)

UnigramForSearch returns unigram string for Document field.

func Unix

func Unix(t time.Time) int64

Unix returns unix time. Number Field is value between -2,147,483,647 and 2,147,483,647. https://cloud.google.com/appengine/docs/go/search/#Go_Documents_and_fields

Types

type DocIDer

type DocIDer interface {
	DocID(c context.Context) (string, error)
}

DocIDer supply DocID method. It can customize docID of Document.

type Op

type Op struct {
	FieldName string
	Type      OpType
	Value     interface{}
	Parent    *Op
	Children  []*Op
}

Op is query operand.

func (*Op) Query

func (op *Op) Query(buffer *bytes.Buffer) error

Query builds query string.

type OpType

type OpType int

OpType is operand type of Search API.

const (
	// Unknown is default value of OpType.
	Unknown OpType = iota
	// Match is OpType value. it match to specified string.
	Match
	// NgramMatch is OpType value. it match to ngram string.
	NgramMatch
	// And generate AND query.
	And
	// Or generate OR query.
	Or
	// Gt generate > query.
	Gt
	// GtEq generate >= query.
	GtEq
	// Lt generate < query.
	Lt
	// LtEq generate <= query.
	LtEq
	// Eq generate = query.
	Eq
	// Group generate ( ... ) query.
	Group
)

type SearchBuilder

type SearchBuilder interface {
	// IndexName returns name of target index.
	IndexName() string
	// QueryString returns query string.
	QueryString() (string, error)
	// SearchOptions returns search options.
	SearchOptions() *search.SearchOptions
}

SearchBuilder is common interface for generated struct base SearchBuilder.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL