Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(
patronFilter,
serviceFilter,
statusFilter,
healthIssueFilter,
selectedNeeds,
benefits,
needs,
eligibilityPaths,
searchString,
currentLanguage,
enIdx,
frIdx
) => {
// Reinitalize indexes after they are serialized by Redux
enIdx = lunr.Index.load(JSON.parse(enIdx));
frIdx = lunr.Index.load(JSON.parse(frIdx));
let selectedEligibility = {
patronType: patronFilter,
serviceType: serviceFilter,
statusAndVitals: statusFilter,
serviceHealthIssue: healthIssueFilter
};
let eligibilityMatch = (path, selected) => {
let matches = true;
[
"serviceType",
"patronType",
"statusAndVitals",
"serviceHealthIssue"
].forEach(criteria => {
function init(logger:Pino.Logger) {
searchIndex = new lunr.Index;
searchIndex.ref('index');
searchIndex.field('name');
const dataSources = sources.getSources();
for (let dataLoop = 0; dataLoop < dataSources.length; dataLoop++)
{
const images = dataSources[dataLoop].images;
for (let imageLoop = 0; imageLoop < images.length; imageLoop++) {
searchIndex.add({index: `${dataLoop}:${imageLoop}`, name: images[imageLoop].name});
imageCount += 1;
}
}
logger.info({ imageCount }, "Images indexed");
function setupTest() {
lunrJsIndex = new lunr.Index();
lunrJsIndex.field("title");
lunrJsIndex.field("author");
lunrJsIndex.ref("isbn");
for (var i = 0, length = books.length; i < length; i++) {
lunrJsIndex.add(books[i]);
}
searchLatest = buildIndex(JsSearchLatest);
searchLocal = buildIndex(JsSearchLocal);
runTests();
}
constructor(props) {
super(props)
this.state = {
query: props.initialQuery,
}
this.index =
typeof props.index === 'string'
? lunr.Index.load(JSON.parse(props.index))
: props.index
this.store =
typeof props.store === 'string' ? JSON.parse(props.store) : props.store
}
constructor(props) {
super(props);
this.enIdx = lunr.Index.load(JSON.parse(this.props.enIdx));
this.frIdx = lunr.Index.load(JSON.parse(this.props.frIdx));
}
async function getIndex() {
const response = await fetch(urls.SEARCH_INDEX, { credentials: 'include' });
const serializedIndex = await response.json();
searchIndex = lunr.Index.load(serializedIndex);
return searchIndex;
}
.add("lunr", () => {
var lunrJsIndex = new lunr.Index();
lunrJsIndex.field("title");
lunrJsIndex.field("author");
lunrJsIndex.ref("isbn");
for (var i = 0, length = books.length; i < length; i++) {
lunrJsIndex.add(books[i]);
}
})
.add("js-worker-search:latest", () => {
function setupTest() {
lunrJsIndex = new lunr.Index();
lunrJsIndex.field('title');
lunrJsIndex.field('author');
lunrJsIndex.ref('isbn');
for (var i = 0, length = books.length; i < length; i++) {
lunrJsIndex.add(books[i]);
}
searchLatest = buildIndex(JsSearchLatest.Search, JsSearchLatest.UnorderedSearchIndex);
searchLatestTfIdf = buildIndex(JsSearchLatest.Search, JsSearchLatest.TfIdfSearchIndex);
searchLocal = buildIndex(JsSearchLocal.Search, JsSearchLocal.UnorderedSearchIndex);
searchLocalTfIdf = buildIndex(JsSearchLocal.Search, JsSearchLocal.TfIdfSearchIndex);
runTests();
}