@@ -15,7 +15,6 @@ import (
15
15
"time"
16
16
17
17
"code.gitea.io/gitea/models/db"
18
- "code.gitea.io/gitea/modules/indexer/issues"
19
18
"code.gitea.io/gitea/modules/indexer/issues/internal"
20
19
"code.gitea.io/gitea/modules/optional"
21
20
"code.gitea.io/gitea/modules/timeutil"
@@ -80,8 +79,8 @@ func TestIndexer(t *testing.T, indexer internal.Indexer) {
80
79
}
81
80
82
81
// test counting
83
- opts := c .SearchOptions .Copy ( func ( options * issues. SearchOptions ) { options . ListOptions = db.ListOptions {PageSize : 0 } })
84
- countResult , err := indexer .Search (context .Background (), opts )
82
+ c .SearchOptions .ListOptions = db.ListOptions {PageSize : 0 }
83
+ countResult , err := indexer .Search (context .Background (), c . SearchOptions )
85
84
require .NoError (t , err )
86
85
assert .Empty (t , countResult .Hits )
87
86
assert .Equal (t , result .Total , countResult .Total )
@@ -91,8 +90,12 @@ func TestIndexer(t *testing.T, indexer internal.Indexer) {
91
90
92
91
var cases = []* testIndexerCase {
93
92
{
94
- Name : "default" ,
95
- SearchOptions : & internal.SearchOptions {},
93
+ Name : "default" ,
94
+ SearchOptions : & internal.SearchOptions {
95
+ ListOptions : db.ListOptions {
96
+ ListAll : true ,
97
+ },
98
+ },
96
99
Expected : func (t * testing.T , data map [int64 ]* internal.IndexerData , result * internal.SearchResult ) {
97
100
assert .Equal (t , len (data ), len (result .Hits ))
98
101
assert .Equal (t , len (data ), int (result .Total ))
@@ -126,6 +129,9 @@ var cases = []*testIndexerCase{
126
129
{ID : 1002 , Comments : []string {"hi" , "hello world" }},
127
130
},
128
131
SearchOptions : & internal.SearchOptions {
132
+ ListOptions : db.ListOptions {
133
+ ListAll : true ,
134
+ },
129
135
Keyword : "hello" ,
130
136
},
131
137
ExpectedIDs : []int64 {1002 , 1001 , 1000 },
@@ -143,6 +149,9 @@ var cases = []*testIndexerCase{
143
149
{ID : 1007 , Title : "hello world" , RepoID : 5 , IsPublic : false },
144
150
},
145
151
SearchOptions : & internal.SearchOptions {
152
+ ListOptions : db.ListOptions {
153
+ ListAll : true ,
154
+ },
146
155
Keyword : "hello" ,
147
156
RepoIDs : []int64 {1 , 4 },
148
157
},
@@ -161,6 +170,9 @@ var cases = []*testIndexerCase{
161
170
{ID : 1007 , Title : "hello world" , RepoID : 5 , IsPublic : false },
162
171
},
163
172
SearchOptions : & internal.SearchOptions {
173
+ ListOptions : db.ListOptions {
174
+ ListAll : true ,
175
+ },
164
176
Keyword : "hello" ,
165
177
RepoIDs : []int64 {1 , 4 },
166
178
AllPublic : true ,
@@ -242,6 +254,9 @@ var cases = []*testIndexerCase{
242
254
{ID : 1004 , Title : "hello e" , LabelIDs : []int64 {}},
243
255
},
244
256
SearchOptions : & internal.SearchOptions {
257
+ ListOptions : db.ListOptions {
258
+ ListAll : true ,
259
+ },
245
260
Keyword : "hello" ,
246
261
IncludedLabelIDs : []int64 {2000 , 2001 },
247
262
ExcludedLabelIDs : []int64 {2003 },
@@ -259,6 +274,9 @@ var cases = []*testIndexerCase{
259
274
{ID : 1004 , Title : "hello e" , LabelIDs : []int64 {}},
260
275
},
261
276
SearchOptions : & internal.SearchOptions {
277
+ ListOptions : db.ListOptions {
278
+ ListAll : true ,
279
+ },
262
280
Keyword : "hello" ,
263
281
IncludedAnyLabelIDs : []int64 {2001 , 2002 },
264
282
ExcludedLabelIDs : []int64 {2003 },
0 commit comments