summaryrefslogtreecommitdiffstats
path: root/src/pattern.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-09 02:37:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-09 10:42:12 +0900
commitaa05bf5206768965e575b6032543745c830e6eea (patch)
tree46689067f45992915ea6549266825556743b489a /src/pattern.go
parentd303c5b3ebc6d56af6d3a03c6b4cdb361a2b022c (diff)
Reduce memory footprint
Diffstat (limited to 'src/pattern.go')
-rw-r--r--src/pattern.go10
1 files changed, 4 insertions, 6 deletions
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