Added support for optional OR searches (documents matching only some of the search tokens) (@dlebech - #82)
Fixes memory leak when re-indexing resource. (@LrsK - #74)
Added support for custom tokenize patterns and case-sensitive searches (supported in js-worker-search
version 1.1.3). Usage is similar to index mode: To override the defaults (tokenize on whitespace only and case-insensitive), pass a configured SearchApi
argument to the reduxSearch
middleware, like so:
import { reduxSearch, SearchApi } from 'redux-search'
const finalCreateStore = compose(
// Other middleware ...
reduxSearch({
resourceIndexes: { ... },
resourceSelector: (resourceName, state) => state.resources.get(resourceName),
searchApi: new SearchApi({
// split on all non-alphanumeric characters,
// so this/that gets split to ['this','that'], for example
tokenizePattern: /[^a-z0-9]+/,
// make the search case-sensitive
caseSensitive: true
})
})
)(createStore)
Builds updated to depend on Babel's babel-runtime
rather than referencing global babelHelpers
.
Added module
attribute to package.json
to point Webpack 2 towards ES module dist.
Added guard against undefined Redux action in reducer.
Added CommonJS and ES6 module builds (as well as the pre-existing UMD build_.
ComonJS build is now the default package.json
target instead of the UMD target.
Added support for configurable index strategy (supported in js-worker-search
version 1.1.0).
Search users can now choose between all-substring matches (default), prefix matches, and exact word matches only.
To override the default, simply pass a configured SearchApi
argument to the reduxSearch
middleware like so:
import { reduxSearch, SearchApi, INDEX_MODES } from 'redux-search'
const indexMode = INDEX_MODES.PREFIXES || INDEX_MODES.EXACT_WORDS || INDEX_MODES.ALL_SUBSTRINGS
const finalCreateStore = compose(
// Other middleware ...
reduxSearch({
resourceIndexes: { ... },
resourceSelector: (resourceName, state) => state.resources.get(resourceName),
searchApi: new SearchApi({ indexMode })
})
)(createStore)
Named state
object passed to custom resource-indexing functions in order to enable more flexible custom indices.
Extract web-worker search utilty into its own NPM package, js-worker-search. Moved web-worker support detection (previously managed by CapabilitiesBasedSearchApi
) into that module as well to simplify the redux-search interface.
If you were previously importing CapabilitiesBasedSearchApi
or WorkerSearchApi
directly you should now just import SearchApi
. It will handle auto-detecting web-worker support and use the correct implementation under the hood.
SearchUtility
will now longer be exported by this package. Import it from js-worker-search instead.
Result selector created by getSearchSelectors
automatically filters the result list to ensure that all results are all present in the resource collection. (See issue #29 for more background information.)
Update getSearchSelectors
references to use named parameters. For example this...
const selectors = getSearchSelectors('books')
...becomes this...
const selectors = getSearchSelectors({
resourceName: 'books',
resourceSelector: (resourceName, state) => state.resources.get(resourceName)
})
Added CapabilitiesBasedSearchApi
for auto-detecting web worker support and degrading if needed.
Exporting SearchUtility
in case library users want to implement custom search functionality.
Initial release.