Skip to main content
Introducing packages.sweber.dev
Documentation menuUpgrading

Upgrading

What changed in each version from 0.1 to 1.0 and what you need to do.

1.0 is a drop-in upgrade from 0.9. It changes nothing in the API or the behaviour: 1.0 is the 0.9 surface, now under semantic versioning. See Stability for what 1.x promises.

Every version before it was also additive, with one exception: 0.8 changed the markup of the results list (see below). @sweberdev/cosine and @sweberdev/cosine-react are released together with the same version number. Index files stay at format version 1 throughout, but an index built with an older version lacks newer features, such as synonyms or boost weights, until you rebuild it.

VersionWhat is newWhat to do
1.0The API of 0.9, now stable and under semantic versioningNothing
0.9API freeze candidate, guides, @experimental tagsNothing
0.8Each result in <cosine-search> is now an <a role="option"> instead of a link inside an <li role="option">. Browser tests with axe. Benchmarks in CIIf you style the results with ::part(result), check the list once: the part now styles the link element. result-title and result-snippet are unchanged
0.7Several indexes (index="a.json b.json", loadIndexes, CosineGroup), the facets attribute and propNothing
0.6"exact phrases" and -excluded words in queries, --boost, parseQueryNothing. Rebuild to store boost weights
0.5cosine.facets(query, { depth })Nothing
0.4--synonyms, --incremental, readIndex, BuildOptions.synonyms and previousNothing. Rebuild to store synonyms
0.3Typo tolerance in keyword search, scope option, attribute and propNothing
0.2cosine-results event. cosine-select carries query and rankNothing
0.1First release: cosine build, cosine search, loadIndex, <cosine-search>, React component and hooks

Upgrading step by step

npm i @sweberdev/cosine@latest @sweberdev/cosine-react@latest
npx cosine build docs --out public/cosine --base-url /docs

Rebuild the index with the new version so that it contains the newest fields. The old index keeps working if you skip this.

To 1.0

0.9 was the candidate for the API freeze and 1.0 keeps its surface unchanged, so upgrading from 0.9 to 1.0 needs no changes. Breaking changes now wait for 2.0.