-
Notifications
You must be signed in to change notification settings - Fork 2
/
conjunctiondisi.go
79 lines (63 loc) · 1.97 KB
/
conjunctiondisi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package search
import (
"github.com/geange/lucene-go/core/types"
"sort"
)
var _ types.DocIdSetIterator = &ConjunctionDISI{}
// ConjunctionDISI
// A conjunction of DocIdSetIterators. Requires that all of its sub-iterators must be on the same
// document all the time. This iterates over the doc ids that are present in each given DocIdSetIterator.
// Public only for use in org.apache.lucene.search.spans.
// lucene.internal
type ConjunctionDISI struct {
lead1 types.DocIdSetIterator
lead2 types.DocIdSetIterator
others []types.DocIdSetIterator
}
func newConjunctionDISI(iterators []types.DocIdSetIterator) *ConjunctionDISI {
// Sort the array the first time to allow the least frequent DocsEnum to
// lead the matching.
sort.Sort(TimSort(iterators))
return &ConjunctionDISI{
lead1: iterators[0],
lead2: iterators[1],
others: iterators[2:],
}
}
var _ sort.Interface = TimSort{}
type TimSort []types.DocIdSetIterator
func (t TimSort) Len() int {
return len(t)
}
func (t TimSort) Less(i, j int) bool {
return t[i].Cost() < t[j].Cost()
}
func (t TimSort) Swap(i, j int) {
t[i], t[j] = t[j], t[i]
}
func (c *ConjunctionDISI) DocID() int {
//TODO implement me
panic("implement me")
}
func (c *ConjunctionDISI) NextDoc() (int, error) {
//TODO implement me
panic("implement me")
}
func (c *ConjunctionDISI) Advance(target int) (int, error) {
//TODO implement me
panic("implement me")
}
func (c *ConjunctionDISI) SlowAdvance(target int) (int, error) {
return types.SlowAdvance(c, target)
}
func (c *ConjunctionDISI) Cost() int64 {
//TODO implement me
panic("implement me")
}
// IntersectIterators Create a conjunction over the provided Scorers. Note that the returned DocIdSetIterator might leverage two-phase iteration in which case it is possible to retrieve the TwoPhaseIterator using TwoPhaseIterator.unwrap.
func IntersectIterators(iterators []types.DocIdSetIterator) types.DocIdSetIterator {
panic("")
}
func (c *ConjunctionDISI) doNext(doc int) (int, error) {
panic("")
}