@internetarchive/search-service
Advanced tools
Comparing version 1.4.1-alpha.1 to 1.4.1
@@ -53,5 +53,6 @@ import { __decorate } from "tslib"; | ||
get avg_rating() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.avg_rating) != null | ||
? new NumberField(this.rawMetadata.fields.avg_rating) | ||
var _a, _b, _c; | ||
const averageRating = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.avg_rating; | ||
return averageRating || averageRating === 0 | ||
? new NumberField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.avg_rating) | ||
: undefined; | ||
@@ -105,5 +106,6 @@ } | ||
get downloads() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.downloads) != null | ||
? new NumberField(this.rawMetadata.fields.downloads) | ||
var _a, _b, _c; | ||
const downloads = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.downloads; | ||
return downloads || downloads === 0 | ||
? new NumberField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.downloads) | ||
: undefined; | ||
@@ -124,5 +126,6 @@ } | ||
get file_creation_mtime() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.file_creation_mtime) != null | ||
? new NumberField(this.rawMetadata.fields.file_creation_mtime) | ||
var _a, _b, _c; | ||
const mTime = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.file_creation_mtime; | ||
return mTime || mTime === 0 | ||
? new NumberField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.file_creation_mtime) | ||
: undefined; | ||
@@ -158,5 +161,6 @@ } | ||
get result_in_subfile() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.result_in_subfile) != null | ||
? new BooleanField(this.rawMetadata.fields.result_in_subfile) | ||
var _a, _b, _c; | ||
const resultInSubfile = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.result_in_subfile; | ||
return resultInSubfile || resultInSubfile === false | ||
? new BooleanField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.result_in_subfile) | ||
: undefined; | ||
@@ -209,5 +213,6 @@ } | ||
get year() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.year) != null | ||
? new NumberField(this.rawMetadata.fields.year) | ||
var _a, _b, _c; | ||
const year = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.year; | ||
return year || year === 0 | ||
? new NumberField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.year) | ||
: undefined; | ||
@@ -220,5 +225,6 @@ } | ||
get start() { | ||
var _a, _b; | ||
return ((_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.start) != null | ||
? new StringField(this.rawMetadata.fields.start) | ||
var _a, _b, _c; | ||
const start = (_b = (_a = this.rawMetadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.start; | ||
return start || start === 0 | ||
? new StringField((_c = this.rawMetadata) === null || _c === void 0 ? void 0 : _c.fields.start) | ||
: undefined; | ||
@@ -225,0 +231,0 @@ } |
@@ -28,3 +28,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
this.returnedCount = (_e = (_d = body === null || body === void 0 ? void 0 : body.hits) === null || _d === void 0 ? void 0 : _d.returned) !== null && _e !== void 0 ? _e : 0; | ||
// Use total hits from search services if federated search | ||
// If page elements include services i.e. fts, | ||
// this indicates a federated search, | ||
// so we should trigger the fed search results handler | ||
if (!(hits === null || hits === void 0 ? void 0 : hits.length) && ((_f = this.pageElements) === null || _f === void 0 ? void 0 : _f.service___fts)) { | ||
@@ -133,6 +135,10 @@ this.totalResults = 0; | ||
const simpleServiceName = this.removeServicePrefix(service); | ||
// Add service name to federated results section | ||
this.federatedResults | ||
? (this.federatedResults[service] = []) | ||
: (this.federatedResults = { [simpleServiceName]: [] }); | ||
// Add service name to federated results section. | ||
// Create section if not already created. | ||
if (this.federatedResults) { | ||
this.federatedResults[service] = []; | ||
} | ||
else { | ||
this.federatedResults = { [simpleServiceName]: [] }; | ||
} | ||
// Add hits to service | ||
@@ -165,3 +171,2 @@ const serviceElementHits = (_b = (_a = this.pageElements) === null || _a === void 0 ? void 0 : _a[service]) === null || _b === void 0 ? void 0 : _b.hits; | ||
return new ItemHit(result); | ||
case 'asr_text': | ||
case 'text': | ||
@@ -168,0 +173,0 @@ case 'asr_text': |
{ | ||
"name": "@internetarchive/search-service", | ||
"version": "1.4.1-alpha.1", | ||
"version": "1.4.1", | ||
"description": "A search service for the Internet Archive", | ||
@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only", |
@@ -61,4 +61,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@Memoize() get avg_rating(): typeof Metadata.prototype.avg_rating { | ||
return this.rawMetadata?.fields?.avg_rating != null | ||
? new NumberField(this.rawMetadata.fields.avg_rating) | ||
const averageRating = this.rawMetadata?.fields?.avg_rating; | ||
return averageRating || averageRating === 0 | ||
? new NumberField(this.rawMetadata?.fields.avg_rating) | ||
: undefined; | ||
@@ -113,4 +115,6 @@ } | ||
@Memoize() get downloads(): typeof Metadata.prototype.downloads { | ||
return this.rawMetadata?.fields?.downloads != null | ||
? new NumberField(this.rawMetadata.fields.downloads) | ||
const downloads = this.rawMetadata?.fields?.downloads; | ||
return downloads || downloads === 0 | ||
? new NumberField(this.rawMetadata?.fields.downloads) | ||
: undefined; | ||
@@ -132,4 +136,6 @@ } | ||
@Memoize() get file_creation_mtime(): NumberField | undefined { | ||
return this.rawMetadata?.fields?.file_creation_mtime != null | ||
? new NumberField(this.rawMetadata.fields.file_creation_mtime) | ||
const mTime = this.rawMetadata?.fields?.file_creation_mtime; | ||
return mTime || mTime === 0 | ||
? new NumberField(this.rawMetadata?.fields.file_creation_mtime) | ||
: undefined; | ||
@@ -166,4 +172,6 @@ } | ||
@Memoize() get result_in_subfile(): BooleanField | undefined { | ||
return this.rawMetadata?.fields?.result_in_subfile != null | ||
? new BooleanField(this.rawMetadata.fields.result_in_subfile) | ||
const resultInSubfile = this.rawMetadata?.fields?.result_in_subfile; | ||
return resultInSubfile || resultInSubfile === false | ||
? new BooleanField(this.rawMetadata?.fields.result_in_subfile) | ||
: undefined; | ||
@@ -217,4 +225,6 @@ } | ||
@Memoize() get year(): NumberField | undefined { | ||
return this.rawMetadata?.fields?.year != null | ||
? new NumberField(this.rawMetadata.fields.year) | ||
const year = this.rawMetadata?.fields?.year; | ||
return year || year === 0 | ||
? new NumberField(this.rawMetadata?.fields.year) | ||
: undefined; | ||
@@ -228,4 +238,6 @@ } | ||
@Memoize() get start(): StringField | undefined { | ||
return this.rawMetadata?.fields?.start != null | ||
? new StringField(this.rawMetadata.fields.start) | ||
const start = this.rawMetadata?.fields?.start; | ||
return start || start === 0 | ||
? new StringField(this.rawMetadata?.fields.start) | ||
: undefined; | ||
@@ -232,0 +244,0 @@ } |
@@ -186,3 +186,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
// Use total hits from search services if federated search | ||
// If page elements include services i.e. fts, | ||
// this indicates a federated search, | ||
// so we should trigger the fed search results handler | ||
if (!hits?.length && this.pageElements?.service___fts) { | ||
@@ -314,6 +316,9 @@ this.totalResults = 0; | ||
// Add service name to federated results section | ||
this.federatedResults | ||
? (this.federatedResults[service] = []) | ||
: (this.federatedResults = { [simpleServiceName]: [] }); | ||
// Add service name to federated results section. | ||
// Create section if not already created. | ||
if (this.federatedResults) { | ||
this.federatedResults[service] = []; | ||
} else { | ||
this.federatedResults = { [simpleServiceName]: [] }; | ||
} | ||
@@ -355,3 +360,2 @@ // Add hits to service | ||
return new ItemHit(result); | ||
case 'asr_text': | ||
case 'text': | ||
@@ -358,0 +362,0 @@ case 'asr_text': |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1134537
16369
1