webcomponents / webcomponents.org

Home of the web components community
https://www.webcomponents.org
Apache License 2.0
359 stars 95 forks source link

Implement basic full-text-search #1359

Closed justinfagnani closed 1 year ago

justinfagnani commented 1 year ago

This implements full-text search by:

  1. Stemming a number of fields and storing the results in an array field in CustomElement documents
  2. Stemming the user's text query
  3. Retrieving elements with a collectionGroup query across the customElement collections and filtering with an array-contains-any operator

I'm using https://github.com/NaturalNode/natural for stemming. It looks well maintained and thorough compared to other libraries.

The fields currently indexed are:

Builds on https://github.com/webcomponents/webcomponents.org/pull/1364. We need to fix https://github.com/webcomponents/webcomponents.org/issues/1351 to ensure that queries are confined to a single namespace.