Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
fix: For #258, creates CRVIZ_SEARCH_REF property to use as ref for in…
Browse files Browse the repository at this point in the history
…dexing
  • Loading branch information
rashley-iqt committed Mar 5, 2019
1 parent 5cb7e7e commit 43d0487
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/epics/index-dataset-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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 };
};

Expand Down
2 changes: 1 addition & 1 deletion src/epics/search-dataset-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const performSearch = (data) => {
results = [...temp];
}
}

data.dataset.forEach((el) => { el.isSearchResult = false; });
results.forEach((r) => {
if(data.dataset[r.ref]){
Expand Down

0 comments on commit 43d0487

Please sign in to comment.