Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the parameters of BM25+ scoring algorithm configurable #186

Merged
merged 5 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

# v6.0.0 (unreleased)

This is a major release. The most notable change is the addition of `discard`,
`discardAll`, and `replace`. These method make it more convenient and performant
to remove or replace documents. This release is almost completely backwards
compatible with `v5`, apart from one breaking change in the behavior of `add`
when the document ID already exists.

- [breaking change] `add`, `addAll`, and `addAllAsync` now throw an error on
duplicate document IDs. When necessary, it is now possible to check for the
existence of a document with a certain ID with the new method `has`.
- Add `discard` method to remove documents by ID. This is a convenient
alternative to `remove` that takes only the ID of the documents to remove,
as opposed to the whole document. The visible effect is the same as
Expand All @@ -20,12 +29,12 @@
or can be triggered manually by calling the `vacuum` method. The new
`dirtCount` and `dirtFactor` properties give the current value of the
parameters used to decide whether to trigger an automatic vacuuming.
- Add `has` method, to check if a document ID is present
- Add `termCount` property, giving the number of distinct terms present in the
index
- Improve TypeScript type of some methods by marking the given array argument
as `readonly`, signaling that it won't be mutated, and allowing passing
readonly arrays.
- Make it possible to overload the `loadJS` static method in subclasses

# v5.1.0

Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.json

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions docs/classes/_minisearch_.minisearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L474">MiniSearch.ts:474</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L484">MiniSearch.ts:484</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -286,7 +286,7 @@ <h3>dirt<wbr>Count</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1002">MiniSearch.ts:1002</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1012">MiniSearch.ts:1012</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -308,7 +308,7 @@ <h3>dirt<wbr>Factor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1013">MiniSearch.ts:1013</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1023">MiniSearch.ts:1023</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -334,7 +334,7 @@ <h3>document<wbr>Count</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1281">MiniSearch.ts:1281</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1291">MiniSearch.ts:1291</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -356,7 +356,7 @@ <h3>is<wbr>Vacuuming</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L995">MiniSearch.ts:995</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1005">MiniSearch.ts:1005</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -378,7 +378,7 @@ <h3>term<wbr>Count</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1288">MiniSearch.ts:1288</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1298">MiniSearch.ts:1298</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -403,7 +403,7 @@ <h3>add</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L589">MiniSearch.ts:589</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L599">MiniSearch.ts:599</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -434,7 +434,7 @@ <h3>add<wbr>All</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L631">MiniSearch.ts:631</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L641">MiniSearch.ts:641</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -465,7 +465,7 @@ <h3>add<wbr>All<wbr>Async</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L646">MiniSearch.ts:646</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L656">MiniSearch.ts:656</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -511,7 +511,7 @@ <h3>auto<wbr>Suggest</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1253">MiniSearch.ts:1253</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1263">MiniSearch.ts:1263</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -597,7 +597,7 @@ <h3>discard</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L793">MiniSearch.ts:793</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L803">MiniSearch.ts:803</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -668,7 +668,7 @@ <h3>discard<wbr>All</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L835">MiniSearch.ts:835</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L845">MiniSearch.ts:845</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -703,7 +703,7 @@ <h3>has</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1023">MiniSearch.ts:1023</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1033">MiniSearch.ts:1033</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -735,7 +735,7 @@ <h3>remove</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L681">MiniSearch.ts:681</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L691">MiniSearch.ts:691</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -773,7 +773,7 @@ <h3>remove<wbr>All</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L733">MiniSearch.ts:733</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L743">MiniSearch.ts:743</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -808,7 +808,7 @@ <h3>replace</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L866">MiniSearch.ts:866</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L876">MiniSearch.ts:876</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -847,7 +847,7 @@ <h3>search</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1165">MiniSearch.ts:1165</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1175">MiniSearch.ts:1175</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -999,7 +999,7 @@ <h3>toJSON</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1528">MiniSearch.ts:1528</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1539">MiniSearch.ts:1539</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1039,7 +1039,7 @@ <h3>vacuum</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L913">MiniSearch.ts:913</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L923">MiniSearch.ts:923</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1100,7 +1100,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Default</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1341">MiniSearch.ts:1341</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1351">MiniSearch.ts:1351</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1146,7 +1146,7 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> loadJSON</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/732d95a/src/MiniSearch.ts#L1313">MiniSearch.ts:1313</a></li>
<li>Defined in <a href="/~https://github.com/lucaong/minisearch/blob/70a26b2/src/MiniSearch.ts#L1323">MiniSearch.ts:1323</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1286,6 +1286,9 @@ <h4 class="tsd-returns-title">Returns <a href="_minisearch_.minisearch.html" cla
<li class=" tsd-kind-type-alias tsd-parent-kind-module">
<a href="../modules/_minisearch_.html#autovacuumoptions" class="tsd-kind-icon">Auto<wbr>Vacuum<wbr>Options</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module">
<a href="../modules/_minisearch_.html#bm25params" class="tsd-kind-icon">BM25<wbr>Params</a>
</li>
<li class=" tsd-kind-type-alias tsd-parent-kind-module">
<a href="../modules/_minisearch_.html#matchinfo" class="tsd-kind-icon">Match<wbr>Info</a>
</li>
Expand Down
Loading