From aa05bf5206768965e575b6032543745c830e6eea Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 9 Jan 2015 02:37:08 +0900 Subject: Reduce memory footprint --- src/pattern.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/pattern.go') diff --git a/src/pattern.go b/src/pattern.go index 7c27f52f..7b294253 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -236,9 +236,8 @@ func (p *Pattern) fuzzyMatch(chunk *Chunk) []*Item { if sidx, eidx := p.iter(FuzzyMatch, input, p.text); sidx >= 0 { matches = append(matches, &Item{ text: item.text, - index: item.index, - offsets: []Offset{Offset{sidx, eidx}}, - rank: NilRank}) + offsets: []Offset{Offset{int32(sidx), int32(eidx)}}, + rank: Rank{0, 0, item.rank.index}}) } } return matches @@ -256,7 +255,7 @@ func (p *Pattern) extendedMatch(chunk *Chunk) []*Item { if term.inv { break Loop } - offsets = append(offsets, Offset{sidx, eidx}) + offsets = append(offsets, Offset{int32(sidx), int32(eidx)}) } else if term.inv { offsets = append(offsets, Offset{0, 0}) } @@ -264,9 +263,8 @@ func (p *Pattern) extendedMatch(chunk *Chunk) []*Item { if len(offsets) == len(p.terms) { matches = append(matches, &Item{ text: item.text, - index: item.index, offsets: offsets, - rank: NilRank}) + rank: Rank{0, 0, item.rank.index}}) } } return matches -- cgit v1.2.3