@@ -95,14 +95,25 @@ class QueryManager<T> implements Query<T> {
9595 public hybrid ( query : string , opts ?: HybridOptions < T > ) : QueryReturn < T > {
9696 return this . check
9797 . hybridSearch ( opts )
98- . then ( ( { search, supportsTargets, supportsWeightsForTargets, supportsVectorsForTargets } ) =>
99- search . withHybrid (
100- Serialize . search . hybrid (
101- { query, supportsTargets, supportsWeightsForTargets, supportsVectorsForTargets } ,
102- opts
103- )
104- )
98+ . then (
99+ async ( {
100+ search,
101+ supportsTargets,
102+ supportsWeightsForTargets,
103+ supportsVectorsForTargets,
104+ supportsVectors,
105+ } ) => ( {
106+ search,
107+ args : await Serialize . search . hybrid ( {
108+ query,
109+ supportsTargets,
110+ supportsWeightsForTargets,
111+ supportsVectorsForTargets,
112+ supportsVectors,
113+ } ) ,
114+ } )
105115 )
116+ . then ( ( { search, args } ) => search . withHybrid ( args ) )
106117 . then ( ( reply ) => this . parseGroupByReply ( opts , reply ) ) ;
107118 }
108119
@@ -112,19 +123,19 @@ class QueryManager<T> implements Query<T> {
112123 return this . check
113124 . nearSearch ( opts )
114125 . then ( ( { search, supportsTargets, supportsWeightsForTargets } ) => {
115- return toBase64FromMedia ( image ) . then ( ( image ) =>
116- search . withNearImage (
117- Serialize . search . nearImage (
118- {
119- image,
120- supportsTargets,
121- supportsWeightsForTargets,
122- } ,
123- opts
124- )
125- )
126- ) ;
126+ return toBase64FromMedia ( image ) . then ( ( image ) => ( {
127+ search,
128+ args : Serialize . search . nearImage (
129+ {
130+ image,
131+ supportsTargets,
132+ supportsWeightsForTargets,
133+ } ,
134+ opts
135+ ) ,
136+ } ) ) ;
127137 } )
138+ . then ( ( { search, args } ) => search . withNearImage ( args ) )
128139 . then ( ( reply ) => this . parseGroupByReply ( opts , reply ) ) ;
129140 }
130141
@@ -183,18 +194,18 @@ class QueryManager<T> implements Query<T> {
183194 public nearObject ( id : string , opts ?: NearOptions < T > ) : QueryReturn < T > {
184195 return this . check
185196 . nearSearch ( opts )
186- . then ( ( { search, supportsTargets, supportsWeightsForTargets } ) =>
187- search . withNearObject (
188- Serialize . search . nearObject (
189- {
190- id,
191- supportsTargets,
192- supportsWeightsForTargets,
193- } ,
194- opts
195- )
196- )
197- )
197+ . then ( ( { search, supportsTargets, supportsWeightsForTargets } ) => ( {
198+ search,
199+ args : Serialize . search . nearObject (
200+ {
201+ id,
202+ supportsTargets,
203+ supportsWeightsForTargets,
204+ } ,
205+ opts
206+ ) ,
207+ } ) )
208+ . then ( ( { search , args } ) => search . withNearObject ( args ) )
198209 . then ( ( reply ) => this . parseGroupByReply ( opts , reply ) ) ;
199210 }
200211
@@ -203,18 +214,18 @@ class QueryManager<T> implements Query<T> {
203214 public nearText ( query : string | string [ ] , opts ?: NearTextOptions < T > ) : QueryReturn < T > {
204215 return this . check
205216 . nearSearch ( opts )
206- . then ( ( { search, supportsTargets, supportsWeightsForTargets } ) =>
207- search . withNearText (
208- Serialize . search . nearText (
209- {
210- query,
211- supportsTargets,
212- supportsWeightsForTargets,
213- } ,
214- opts
215- )
216- )
217- )
217+ . then ( ( { search, supportsTargets, supportsWeightsForTargets } ) => ( {
218+ search,
219+ args : Serialize . search . nearText (
220+ {
221+ query,
222+ supportsTargets,
223+ supportsWeightsForTargets,
224+ } ,
225+ opts
226+ ) ,
227+ } ) )
228+ . then ( ( { search , args } ) => search . withNearText ( args ) )
218229 . then ( ( reply ) => this . parseGroupByReply ( opts , reply ) ) ;
219230 }
220231
@@ -223,25 +234,34 @@ class QueryManager<T> implements Query<T> {
223234 public nearVector ( vector : NearVectorInputType , opts ?: NearOptions < T > ) : QueryReturn < T > {
224235 return this . check
225236 . nearVector ( vector , opts )
226- . then ( ( { search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets } ) =>
227- search . withNearVector (
228- Serialize . search . nearVector (
237+ . then (
238+ async ( {
239+ search,
240+ supportsTargets,
241+ supportsVectorsForTargets,
242+ supportsWeightsForTargets,
243+ supportsVectors,
244+ } ) => ( {
245+ search,
246+ args : await Serialize . search . nearVector (
229247 {
230248 vector,
231249 supportsTargets,
232250 supportsVectorsForTargets,
233251 supportsWeightsForTargets,
252+ supportsVectors,
234253 } ,
235254 opts
236- )
237- )
255+ ) ,
256+ } )
238257 )
258+ . then ( ( { search, args } ) => search . withNearVector ( args ) )
239259 . then ( ( reply ) => this . parseGroupByReply ( opts , reply ) ) ;
240260 }
241261}
242262
243263export default QueryManager . use ;
244-
264+ export { queryFactory } from './factories.js' ;
245265export {
246266 BaseBm25Options ,
247267 BaseHybridOptions ,
0 commit comments