added test of field term locations
This commit is contained in:
parent
524e332ad9
commit
7fc21d6094
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue