File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -113,23 +113,23 @@ export class Lyra<TSchema extends PropertiesSchema = PropertiesSchema> {
113
113
const results : RetrievedDoc < TSchema > [ ] = Array . from ( {
114
114
length : limit ,
115
115
} ) ;
116
- let totalResults = 0 ;
116
+ let count = 0 ;
117
117
118
118
const timeStart = getNanosecondsTime ( ) ;
119
119
120
120
let i = 0 ;
121
121
let j = 0 ;
122
122
123
- for ( const token of tokens ) {
123
+ for ( const term of tokens ) {
124
124
for ( const index of indices ) {
125
125
const documentIDs = await this . getDocumentIDsFromSearch ( {
126
126
...params ,
127
- index : index ,
128
- term : token ,
129
- exact : exact ,
127
+ index,
128
+ term,
129
+ exact,
130
130
} ) ;
131
131
132
- totalResults += documentIDs . size ;
132
+ count += documentIDs . size ;
133
133
134
134
if ( i >= limit ) {
135
135
break ;
@@ -154,10 +154,12 @@ export class Lyra<TSchema extends PropertiesSchema = PropertiesSchema> {
154
154
}
155
155
}
156
156
157
+ const hits = results . filter ( Boolean ) ;
158
+
157
159
return {
158
160
elapsed : formatNanoseconds ( getNanosecondsTime ( ) - timeStart ) ,
159
- hits : results ,
160
- count : totalResults ,
161
+ hits,
162
+ count,
161
163
} ;
162
164
}
163
165
You can’t perform that action at this time.
0 commit comments