-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Having a Spotr instance be tied to a single collection
through initial configuration, or being assigned later is an inconvenient limitation when someone wants to search similar collections using the same fields and keyword matchers. Cloning a Spotr instance or writing a duplicate configuration isn't DRY.
Use case:
- I want to search multiple collections, derived from one or more collections. For instance, I have a master collection of pages within an application, each with their own metadata. The application gives the user recently visited places or favorite places, which may be managed in separate arrays.
Example:
search.query(collection, query)
// => [filtered collection]
Error handling:
- Need to handle errors where a field doesn't exist when it's defined in
fields
orfilters
- Need to handle empty collections
Other considerations:
- This will be API breaking, but we're in alpha, no biggy
- Remove class-level
collection
property. Collections must always be passed intoquery()
- Could memoize the
query()
method:
const queryRecents = query => {
return search.query(recentsCollection, query)
}
queryRecents('balances')