diff --git a/package.json b/package.json index 1813294..8f32db9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@sajari/sdk-js", "description": "Sajari JavaScript SDK", - "version": "2.8.1", + "version": "2.8.2", "main": "dist/index.js", "umd:main": "dist/sajarisdk.umd.production.js", "module": "dist/sajarisdk.esm.production.js", diff --git a/src/index.ts b/src/index.ts index 50ede1b..f87dd95 100644 --- a/src/index.ts +++ b/src/index.ts @@ -468,12 +468,12 @@ class QueryPipeline extends EventEmitter { return { indexScore, + ...(neuralScore && { neuralScore }), + ...(featureScore && { featureScore }), score, values: processProtoValues(values), token: t, promotionPinned, - ...(neuralScore && { neuralScore }), - ...(featureScore && { featureScore }), }; } ); @@ -498,12 +498,12 @@ class QueryPipeline extends EventEmitter { jsonProto.searchResponse?.totalResults || "0", 10 ), + featureScoreWeight: jsonProto.searchResponse?.featureScoreWeight || 0, results: results, aggregates: aggregates, aggregateFilters: aggregateFilters, redirects: redirects, activePromotions: activePromotions, - featureScoreWeight: jsonProto.searchResponse?.featureScoreWeight || 0, }, jsonProto.values || {}, ]; @@ -521,6 +521,11 @@ export interface SearchResponse { */ totalResults: number; + /** + * Feature score weight determines the weighting of featureScore vs neural and index scores. + */ + featureScoreWeight: number; + /** * Results of the query. */ @@ -545,11 +550,6 @@ export interface SearchResponse { * All Promotions activated by the current query (see [[ActivePromotion]]). */ activePromotions: ActivePromotion[]; - - /** - * Feature score weight determines the weighting of featureScore vs neural and index scores. - */ - featureScoreWeight: number; } export interface Result { @@ -557,10 +557,6 @@ export interface Result { * indexScore is the index-matched score of this [[Result]]. */ indexScore: number; - /** - * score is the overall score of this [[Result]]. - */ - score: number; /** * neuralScore is the neural score of this [[Result]]. */ @@ -569,6 +565,10 @@ export interface Result { * featureScore is the feature based search score of this [[Result]]. */ featureScore?: number; + /** + * score is the overall score of this [[Result]]. + */ + score: number; /** * values is an object of field-value pairs. */ @@ -666,10 +666,10 @@ export interface SearchResponseProto { searchResponse?: Partial<{ time: string; totalResults: string; + featureScoreWeight?: number; results: ResultProto[]; aggregates: AggregatesProto; aggregateFilters: AggregatesProto; - featureScoreWeight?: number; }>; tokens?: TokenProto[]; values?: Record; diff --git a/src/user-agent.ts b/src/user-agent.ts index c9f71fd..1f3bcf2 100644 --- a/src/user-agent.ts +++ b/src/user-agent.ts @@ -16,6 +16,6 @@ if (scriptTag) { * user agent of sdk * @hidden */ -export const USER_AGENT = ["sajari-sdk-js/2.8.1", suffix] +export const USER_AGENT = ["sajari-sdk-js/2.8.2", suffix] .filter(Boolean) .join(" ");