Local search (#220)

* Version Bump

* local search skeleton

* Added WaitService middleware

* Return matching queries

* wait action middleware rename/refactor

* bigger debounce time

* Fix: Initialize state using Immutable

* Local Search without integrations

* Local Search refactor: Keep state in closure, recurse

* “string” should be treated as the default widget by the inference. Closes #199
This commit is contained in:
Cássio Souza
2017-01-19 15:50:26 -02:00
committed by GitHub
parent f5d1fa7314
commit 0e10c3f984
7 changed files with 163 additions and 49 deletions

View File

@ -100,14 +100,13 @@ export const selectInferedField = (collection, fieldName) => {
// If colllection has no fields or fieldName is not defined within inferables list, return null
if (!fields || !inferableField) return null;
// Try to return a field of the specified type with one of the synonyms
const mainTypeFields = fields.filter(f => f.get('widget') === inferableField.type).map(f => f.get('name'));
const mainTypeFields = fields.filter(f => f.get('widget', 'string') === inferableField.type).map(f => f.get('name'));
field = mainTypeFields.filter(f => inferableField.synonyms.indexOf(f) !== -1);
if (field && field.size > 0) return field.first();
// Try to return a field for each of the specified secondary types
const secondaryTypeFields = fields.filter(f => inferableField.secondaryTypes.indexOf(f.get('widget')) !== -1).map(f => f.get('name'));
const secondaryTypeFields = fields.filter(f => inferableField.secondaryTypes.indexOf(f.get('widget', 'string')) !== -1).map(f => f.get('name'));
field = secondaryTypeFields.filter(f => inferableField.synonyms.indexOf(f) !== -1);
if (field && field.size > 0) return field.first();

View File

@ -13,7 +13,7 @@ let response;
let page;
let searchTerm;
const defaultState = Map({ isFetching: false, term: null, page: 0, entryIds: [], queryHits: [] });
const defaultState = Map({ isFetching: false, term: null, page: 0, entryIds: List([]), queryHits: Map({}) });
const entries = (state = defaultState, action) => {
switch (action.type) {