Skip to content

Commit

Permalink
#1265 revert manipulation of search configuration, now done inside the
Browse files Browse the repository at this point in the history
search component
  • Loading branch information
jrmartin committed Dec 1, 2021
1 parent 4876fb2 commit a77d39c
Showing 1 changed file with 3 additions and 45 deletions.
48 changes: 3 additions & 45 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class VFBMain extends React.Component {

constructor (props) {
super(props);
this.datasourceConfiguration = require('./configuration/VFBMain/searchConfiguration').datasourceConfiguration;

this.state = {
canvasAvailable: false,
Expand All @@ -55,8 +54,7 @@ class VFBMain extends React.Component {
UIUpdated: true,
wireframeVisible: false,
downloadContentsVisible : true,
uploaderContentsVisible : true,
searchDataSourceConfiguration : this.datasourceConfiguration
uploaderContentsVisible : true
};

this.addVfbId = this.addVfbId.bind(this);
Expand All @@ -74,7 +72,6 @@ class VFBMain extends React.Component {
this.handlerInstanceUpdate = this.handlerInstanceUpdate.bind(this);
this.handleSceneAndTermInfoCallback = this.handleSceneAndTermInfoCallback.bind(this);
this.instancesFromDifferentTemplates = this.instancesFromDifferentTemplates.bind(this);
this.filterSelection = this.filterSelection.bind(this);

this.vfbLoadBuffer = [];
this.tutorialRender = undefined;
Expand Down Expand Up @@ -103,6 +100,7 @@ class VFBMain extends React.Component {

this.searchStyle = require('./configuration/VFBMain/searchConfiguration').searchStyle;
this.searchConfiguration = require('./configuration/VFBMain/searchConfiguration').searchConfiguration;
this.datasourceConfiguration = require('./configuration/VFBMain/searchConfiguration').datasourceConfiguration;

this.queryResultsColMeta = require('./configuration/VFBMain/queryBuilderConfiguration').queryResultsColMeta;
this.queryResultsColumns = require('./configuration/VFBMain/queryBuilderConfiguration').queryResultsColumns;
Expand Down Expand Up @@ -1641,45 +1639,6 @@ class VFBMain extends React.Component {
}
}
}

lookupFilter (item, bq, filterValue){
let lookup = "facets_annotation:" + item.key;
let re = new RegExp(lookup, 'g');
let found = bq.match(re);
if ( found ){
return bq.replace(found[0] + filterValue, "");
}
return bq;
}

filterSelection (item) {
let bq = this.state.searchDataSourceConfiguration.query_settings.bq;

switch (item.enabled) {
case "disabled":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_positive);
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_negative);
break;
case "positive":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_negative);
bq += " facets_annotation:" + item.key + "^100";
break;
case "negative":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_positive);
bq += " facets_annotation:" + item.key + "^0.001";
break;
default:
break;
}
let updatedConfiguration = Object.assign(this.state.searchDataSourceConfiguration, {
query_settings : {
...this.state.searchDataSourceConfiguration.query_settings,
bq : bq
}
});
this.setState({ searchDataSourceConfiguration : updatedConfiguration })

}

render () {
if ((this.state.tutorialWidgetVisible == true) && (this.tutorialRender == undefined)) {
Expand Down Expand Up @@ -1800,10 +1759,9 @@ class VFBMain extends React.Component {

<Search ref="searchRef"
datasource="SOLR"
filtersListener={this.filterSelection}
searchStyle={this.searchStyle}
searchConfiguration={this.searchConfiguration}
datasourceConfiguration={this.state.searchDataSourceConfiguration} />
datasourceConfiguration={this.datasourceConfiguration} />

<VFBDownloadContents ref="downloadContentsRef" open={false} />

Expand Down

0 comments on commit a77d39c

Please sign in to comment.