# @barnabask/astro-minisearch

## 2.1.1

### Patch Changes

- 3d971c2: fix API link

## 2.1.0

### Minor Changes

- 4c997b5: Allow promises and nested promises in `generateIndex` for better DX.
  Expose new `getDocuments` function for testing and debugging.
  Remove duplicates and missing URLs with a warning.
  Update demo to match new signature and include SSR search page.

### Patch Changes

- 220e3fc: add API documentation

## 2.0.1

### Patch Changes

- 3a942ee: fix: add slug to pages with headings
- 31c88a6: fix: make exports more sane

## 2.0.0

### Major Changes

- b683dcd: Index Astro v2 content collections.

  A new addition to Astro v2 is [content collections].
  Now you can index content collections alongside the traditional page-based routes.
  Unlike pages, content collections don't have a URL so you have to supply the content root URL.
  The [README](/packages/astro-minisearch/README.md) and demo has been updated with examples.

  [content collections]: https://docs.astro.build/en/guides/content-collections/

  ### Potentially breaking changes

  - The MiniSearch library was updated to v6.
  - The function `getDocuments` was removed because it was incompatible with content collections.
  - The arguments to the function `getSearchIndex` have changed.
    In the past it was possible to pass in either `import.meta.glob` output or search documents,
    but now it only allows a simple array of search documents and requires conversion functions.
  - The internal function `mapGlobResult` has been renamed to `pagesGlobToDocuments` and exposed.
  - Now using Zod for options and page frontmatter validation, which may result in new behavior.

## 1.1.1

### Patch Changes

- 310bfb9: bug: fix [error "missing url"](https://github.com/Barnabas/astro-minisearch/issues/2)
  by ensuring that URL is a string, not truthy. Thanks @mrienstra!

## 1.1.0

### Minor Changes

- 52db74a: Refactor to include headings text in separate field

  During testing, it became clear that search the search results UI needs to display the heading text.
  Otherwise it's impossible to differentiate search results.

  Heading IDs were previously generated by the plain text plugin.
  To allow for handmade plaintext without knowing the final IDs, the format was changed from key/value pairs to array-of-arrays.
  Now the heading IDs are generated by `getDocuments`.

  Old version:

  ```yml
  plainText:
    "": This is the top of the page.
    section-1: Section 1 Here is some content for section 1.
    section-2: Section 2 Here is other text for section 2.
  ```

  New version:

  ```yml
  - - ""
    - This is the top of the page
  - - Section 1
    - Here is some content for section 1.
  - - Section 2
    - This is other text for section 2.
  ```

### Patch Changes

- f3d59b0: Let loadIndex use string or pojo

## 1.0.0

### Major Changes

- 0e78c30: First release
