Example #1
0
func (idoc *IdxDoc) update(object Indexable) {
	idoc.m.Lock()
	defer idoc.m.Unlock()
	flattened := util.Indexify(object.Flatten())
	flatText := strings.Join(flattened, "\n")
	/* recover from horrific trie errors that seem to happen with really
	 * big values. :-/ */
	defer func() {
		if e := recover(); e != nil {
			logger.Errorf("There was a problem creating the trie: %s", fmt.Sprintln(e))
		}
	}()
	trie, err := gtrie.Create(flattened)
	if err != nil {
		logger.Errorf(err.Error())
	} else {
		var err error
		idoc.trie, err = compressTrie(trie)
		if err != nil {
			panic(err)
		}
		idoc.docText, err = compressText(flatText)
		if err != nil {
			panic(err)
		}
	}
}
Example #2
0
// Flatten a data bag item out so it's suitable for indexing.
func (dbi *DataBagItem) Flatten() []string {
	flatten := make(map[string]interface{})
	for key, v := range dbi.RawData {
		subExpand := util.DeepMerge(key, v)
		for k, u := range subExpand {
			flatten[k] = u
		}
	}
	indexified := util.Indexify(flatten)
	return indexified
}
Example #3
0
// Flatten a node for indexing.
func (n *Node) Flatten() []string {
	flatten := util.FlattenObj(n)
	indexified := util.Indexify(flatten)
	return indexified
}
Example #4
0
// Flatten a role so it's suitable for indexing.
func (r *Role) Flatten() []string {
	flatten := util.FlattenObj(r)
	indexified := util.Indexify(flatten)
	return indexified
}
Example #5
0
// Flatten the environment so it's suitable for indexing.
func (e *ChefEnvironment) Flatten() []string {
	flatten := util.FlattenObj(e)
	indexified := util.Indexify(flatten)
	return indexified
}
Example #6
0
// Flatten out the client so it's suitable for indexing.
func (c *Client) Flatten() []string {
	flatten := util.FlattenObj(c.flatExport())
	indexified := util.Indexify(flatten)
	return indexified
}
Example #7
0
func (to *testObj) Flatten() []string {
	flatten := util.FlattenObj(to)
	indexified := util.Indexify(flatten)
	return indexified
}