@orama/orama
Advanced tools
Comparing version 2.0.18 to 2.0.19
@@ -330,3 +330,3 @@ import { createError } from '../errors.js'; | ||
// @todo: convert this into a for loop | ||
safeArrayPush(filtersMap[param], ids.map(({ docIDs })=>docIDs).flat()); | ||
safeArrayPush(filtersMap[param], ids.flatMap(({ docIDs })=>docIDs)); | ||
} else { | ||
@@ -336,3 +336,3 @@ const { coordinates , inside =true , highPrecision =false } = operation[reqOperation]; | ||
// @todo: convert this into a for loop | ||
safeArrayPush(filtersMap[param], ids.map(({ docIDs })=>docIDs).flat()); | ||
safeArrayPush(filtersMap[param], ids.flatMap(({ docIDs })=>docIDs)); | ||
} | ||
@@ -361,7 +361,4 @@ continue; | ||
if (type === 'Flat') { | ||
if (isArray) { | ||
safeArrayPush(filtersMap[param], flatFilterArr(node, operation)); | ||
} else { | ||
safeArrayPush(filtersMap[param], flatFilter(node, operation)); | ||
} | ||
const flatOperation = isArray ? flatFilterArr : flatFilter; | ||
safeArrayPush(filtersMap[param], flatOperation(node, operation)); | ||
continue; | ||
@@ -410,4 +407,3 @@ } | ||
// AND operation: calculate the intersection between all the IDs in filterMap | ||
const result = intersect(Object.values(filtersMap)); | ||
return result; | ||
return intersect(Object.values(filtersMap)); | ||
} | ||
@@ -414,0 +410,0 @@ export async function getSearchableProperties(index) { |
@@ -117,5 +117,5 @@ import { formatElapsedTime, getDocumentIndexId, getDocumentProperties, validateSchema } from '../components/defaults.js'; | ||
function getVersion() { | ||
return '2.0.18'; | ||
return '2.0.19'; | ||
} | ||
//# sourceMappingURL=create.js.map |
@@ -1,2 +0,2 @@ | ||
import type { AnyOrama, TypedDocument, SearchParamsFullText, Results } from '../types.js'; | ||
import type { AnyOrama, Results, SearchParamsFullText, TypedDocument } from '../types.js'; | ||
export declare function fullTextSearch<T extends AnyOrama, ResultDocument = TypedDocument<T>>(orama: T, params: SearchParamsFullText<T, ResultDocument>, language?: string): Promise<Results<ResultDocument>>; |
@@ -1,10 +0,10 @@ | ||
import { getInternalDocumentId } from '../components/internal-document-id-store.js'; | ||
import { getNanosecondsTime, removeVectorsFromHits, safeArrayPush, sortTokenScorePredicate } from '../utils.js'; | ||
import { intersectFilteredIDs } from '../components/filters.js'; | ||
import { prioritizeTokenScores } from '../components/algorithms.js'; | ||
import { createError } from '../errors.js'; | ||
import { createSearchContext, defaultBM25Params, fetchDocumentsWithDistinct, fetchDocuments } from './search.js'; | ||
import { getFacets } from '../components/facets.js'; | ||
import { intersectFilteredIDs } from '../components/filters.js'; | ||
import { getGroups } from '../components/groups.js'; | ||
import { runBeforeSearch, runAfterSearch } from '../components/hooks.js'; | ||
import { runAfterSearch, runBeforeSearch } from '../components/hooks.js'; | ||
import { getInternalDocumentId } from '../components/internal-document-id-store.js'; | ||
import { createError } from '../errors.js'; | ||
import { getNanosecondsTime, removeVectorsFromHits, safeArrayPush, sortTokenScorePredicate } from '../utils.js'; | ||
import { createSearchContext, defaultBM25Params, fetchDocuments, fetchDocumentsWithDistinct } from './search.js'; | ||
export async function fullTextSearch(orama, params, language) { | ||
@@ -47,3 +47,3 @@ const timeStart = await getNanosecondsTime(); | ||
const tokensLength = tokens.length; | ||
if (tokensLength || properties && properties.length > 0) { | ||
if (tokensLength || (properties === null || properties === void 0 ? void 0 : properties.length)) { | ||
// Now it's time to loop over all the indices and get the documents IDs for every single term | ||
@@ -54,2 +54,3 @@ const indexesLength = propertiesToSearch.length; | ||
const prop = propertiesToSearch[i]; | ||
const docIds = context.indexMap[prop]; | ||
if (tokensLength !== 0) { | ||
@@ -60,10 +61,9 @@ for(let j = 0; j < tokensLength; j++){ | ||
const scoreList = await orama.index.search(context, index, prop, term); | ||
safeArrayPush(context.indexMap[prop][term], scoreList); | ||
safeArrayPush(docIds[term], scoreList); | ||
} | ||
} else { | ||
context.indexMap[prop][''] = []; | ||
docIds[''] = []; | ||
const scoreList = await orama.index.search(context, index, prop, ''); | ||
safeArrayPush(context.indexMap[prop][''], scoreList); | ||
safeArrayPush(docIds[''], scoreList); | ||
} | ||
const docIds = context.indexMap[prop]; | ||
const vals = Object.values(docIds); | ||
@@ -70,0 +70,0 @@ context.docsIntersection[prop] = prioritizeTokenScores(vals, (params === null || params === void 0 ? void 0 : (_params_boost = params.boost) === null || _params_boost === void 0 ? void 0 : _params_boost[prop]) ?? 1, threshold, tokensLength); |
{ | ||
"name": "@orama/orama", | ||
"version": "2.0.18", | ||
"version": "2.0.19", | ||
"type": "module", | ||
@@ -89,4 +89,4 @@ "description": "Next generation full-text and vector search engine, written in TypeScript", | ||
"typescript": "^5.0.0", | ||
"@orama/stemmers": "2.0.18", | ||
"@orama/stopwords": "2.0.18" | ||
"@orama/stemmers": "2.0.19", | ||
"@orama/stopwords": "2.0.19" | ||
}, | ||
@@ -93,0 +93,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
710306
6940