0
0
Fork 0

added test of field term locations

This commit is contained in:
Marty Schoch 2014-04-19 14:49:15 -04:00
parent 524e332ad9
commit 7fc21d6094
1 changed files with 19 additions and 1 deletions

View File

@ -40,6 +40,14 @@ func TestTermScorer(t *testing.T) {
ID: "one",
Freq: 1,
Norm: 1.0,
Vectors: []*index.TermFieldVector{
&index.TermFieldVector{
Field: "desc",
Pos: 1,
Start: 0,
End: 4,
},
},
},
result: &DocumentMatch{
ID: "one",
@ -62,6 +70,17 @@ func TestTermScorer(t *testing.T) {
},
},
},
Locations: FieldTermLocationMap{
"desc": TermLocationMap{
"beer": Locations{
&Location{
Pos: 1,
Start: 0,
End: 4,
},
},
},
},
},
},
// test the same thing again (score should be cached this time)
@ -131,7 +150,6 @@ func TestTermScorer(t *testing.T) {
if !reflect.DeepEqual(actual, test.result) {
t.Errorf("expected %#v got %#v for %#v", test.result, actual, test.termMatch)
t.Logf("expl: %s", actual.Expl)
}
}