Skip to content

Commit

Permalink
Better naming of variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaong committed Nov 21, 2024
1 parent 7f24aaf commit fd8965b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/MiniSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ export default class MiniSearch<T = any> {
*/
search (query: Query, searchOptions: SearchOptions = {}): SearchResult[] {
const { searchOptions: globalSearchOptions } = this._options
const options = { ...globalSearchOptions, ...searchOptions }
const searchOptionsWithDefaults: SearchOptionsWithDefaults = { ...globalSearchOptions, ...searchOptions }

const rawResults = this.executeQuery(query, searchOptions)
const results = []
Expand All @@ -1347,15 +1347,14 @@ export default class MiniSearch<T = any> {
}

Object.assign(result, this._storedFields.get(docId))
if (options.filter == null || options.filter(result)) {
if (searchOptionsWithDefaults.filter == null || searchOptionsWithDefaults.filter(result)) {
results.push(result)
}
}

// If it's a wildcard query, and no document boost is applied, skip sorting
// the results, as all results have the same score of 1
if (query === MiniSearch.wildcard &&
options.boostDocument == null) {
if (query === MiniSearch.wildcard && searchOptionsWithDefaults.boostDocument == null) {
return results
}

Expand Down

0 comments on commit fd8965b

Please sign in to comment.