From 43d0487332ac3d67650ec48fc63eab94b8591905 Mon Sep 17 00:00:00 2001 From: Ryan Ashley Date: Tue, 5 Mar 2019 12:32:26 -0500 Subject: [PATCH] fix: For #258, creates CRVIZ_SEARCH_REF property to use as ref for indexing --- src/epics/index-dataset-epic.js | 5 +++-- src/epics/search-dataset-epic.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/epics/index-dataset-epic.js b/src/epics/index-dataset-epic.js index 4b9a049e6..ab4473b7a 100644 --- a/src/epics/index-dataset-epic.js +++ b/src/epics/index-dataset-epic.js @@ -69,7 +69,7 @@ const flattenDataset = (ds, cfg) => { return flattened; for(var key in ds){ - var item = {'id':key}; + var item = {'CRVIZ_SEARCH_REF':key}; for(var f in cfg.fields){ var field = cfg.fields[f]; @@ -88,13 +88,14 @@ const generateIndex = (payload) => { ? payload.configuration : configurationFor(dataset); var flat = flattenDataset(dataset, configuration); const idx = lunr(function () { - this.ref('id'); + this.ref('CRVIZ_SEARCH_REF'); if(configuration && configuration.fields){ const filteredFields = configuration.fields.filter(f => !f.displayName.includes("/")) filteredFields.map((field) => { return this.field(field.displayName.toLowerCase()); }) } flat.map((item) => { return this.add(item); }) }); + return { owner: owner, index: idx }; }; diff --git a/src/epics/search-dataset-epic.js b/src/epics/search-dataset-epic.js index 211df5778..804760a5a 100644 --- a/src/epics/search-dataset-epic.js +++ b/src/epics/search-dataset-epic.js @@ -48,7 +48,7 @@ const performSearch = (data) => { results = [...temp]; } } - + data.dataset.forEach((el) => { el.isSearchResult = false; }); results.forEach((r) => { if(data.dataset[r.ref]){