search

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIndexedTerms = "" /* 817-byte string literal not displayed */

DefaultIndexedTerms holds terms to index from last hosted dfuse infra

Variables

View Source
var TestMatchCollector = func(ctx context.Context, lowBlockNum, highBlockNum uint64, results bsearch.DocumentMatchCollection) (out []search.SearchMatch, err error) {
	trxs := make(map[string][]uint16)
	var trxList []*testTrxResult

	for _, el := range results {
		if err := ctx.Err(); err != nil {
			return nil, err
		}

		blockNum, trxID, actionIdx, skip := testExplodeDocumentID(el.ID)
		if skip {
			continue
		}

		if blockNum < lowBlockNum || blockNum > highBlockNum {
			continue
		}

		if _, found := trxs[trxID]; !found {
			trxList = append(trxList, &testTrxResult{
				id:       trxID,
				blockNum: blockNum,
			})
		}

		trxs[trxID] = append(trxs[trxID], actionIdx)
	}

	for _, trx := range trxList {
		actions := trxs[trx.id]
		sort.Slice(actions, func(i, j int) bool { return actions[i] < actions[j] })

		out = append(out, &SearchMatch{
			TrxIDPrefix:   trx.id,
			ActionIndexes: actions,
			BlockNumber:   trx.blockNum,
		})
	}

	return out, nil
}

Functions

func RegisterDefaultHandlers

func RegisterDefaultHandlers()

func RegisterHandlers

func RegisterHandlers(terms *IndexedTerms)

Types

type BatchActionUpdater

type BatchActionUpdater = func(trxID string, idx int, data map[string]interface{}) error

type BleveQueryValidator

type BleveQueryValidator struct {
	// contains filtered or unexported fields
}

func (*BleveQueryValidator) Validate

func (v *BleveQueryValidator) Validate(q *search.BleveQuery) error

type BlockMapper

type BlockMapper struct {
	*mapping.IndexMappingImpl
	// contains filtered or unexported fields
}

func NewBlockMapper

func NewBlockMapper(eventsActionName string, eventsUnrestricted bool, indexedTermsSpecs string) (*BlockMapper, error)

func (*BlockMapper) IndexedTerms

func (m *BlockMapper) IndexedTerms() *IndexedTerms

func (*BlockMapper) Map

func (m *BlockMapper) Map(block *bstream.Block) ([]*document.Document, error)

type IndexedTerms

type IndexedTerms struct {
	Receiver    bool
	Account     bool
	Action      bool
	Auth        bool
	Scheduled   bool
	Status      bool
	Notif       bool
	Input       bool
	Event       bool
	RAMConsumed bool
	RAMReleased bool
	DBTable     bool
	DBKey       bool

	Base map[string]bool
	Data map[string]bool
}

func NewIndexedTerms

func NewIndexedTerms(specs string) (out *IndexedTerms, err error)

func (*IndexedTerms) IsIndexed

func (t *IndexedTerms) IsIndexed(fieldName string) bool

func (*IndexedTerms) NormalizeDataField

func (t *IndexedTerms) NormalizeDataField(fieldName string) string

NormalizeDataTerm extracts the the first child element from the data name (i.e. from `data.first.second.third` to `first` where `data` is the parent name, `first.second.third` is the child hierarchy and `first` is the first child element of `data`).

type SearchMatch

type SearchMatch struct {
	TrxIDPrefix   string   `json:"prefix"` // ID prefix
	ActionIndexes []uint16 `json:"acts"`   // Action indexes within the transactions
	BlockNumber   uint64   `json:"blk"`    // Current block for this trx
	Index         uint64   `json:"idx"`    // Index of the matching transaction within a block (depends on order of sort)
}

func (*SearchMatch) BlockNum

func (m *SearchMatch) BlockNum() uint64

func (*SearchMatch) FillProtoSpecific

func (m *SearchMatch) FillProtoSpecific(match *pbsearch.SearchMatch, block *bstream.Block) (err error)

func (*SearchMatch) GetIndex

func (m *SearchMatch) GetIndex() uint64

func (*SearchMatch) SetIndex

func (m *SearchMatch) SetIndex(index uint64)

func (*SearchMatch) TransactionIDPrefix

func (m *SearchMatch) TransactionIDPrefix() string

Jump to

Keyboard shortcuts

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