From 132651d25094236fe043d2f318cac2faeeb7aa59 Mon Sep 17 00:00:00 2001
From: Mike Lynch <mike@mikelynch.org>
Date: Mon, 18 Nov 2019 13:03:39 +1100
Subject: [PATCH] elasticsearch queries are getting through the webpack dev
 proxy

---
 config.json              | 10 ++++++----
 src/components/Router.js |  8 ++++----
 src/index.js             |  2 +-
 webpack.config.js        |  3 ++-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/config.json b/config.json
index e9862eb..d86dcd2 100644
--- a/config.json
+++ b/config.json
@@ -1,13 +1,15 @@
 {
   "repo": "http://localhost:8080/repo/",
   "core": "repo",
-  "api": "/solr/ocflcore",
+  "api": "/_search",
   "dev": {
     "proxy": {
-      "/solr/ocflcore": {
-        "target": "http://localhost:8080",
-        "secure": false
+      "/_search": {
+        "target": "http://localhost:9200/ocfl/_search",
+        "secure": false,
+        "logLevel": "debug"
       }
     }
+
   }
 }
\ No newline at end of file
diff --git a/src/components/Router.js b/src/components/Router.js
index bf69436..20a6fc6 100644
--- a/src/components/Router.js
+++ b/src/components/Router.js
@@ -8,7 +8,7 @@ const ViewDoc = require('./views/ViewDoc');
 const ViewError = require('./views/ViewError');
 const FacetController = require('./FacetController');
 
-const solrService = require('./SolrService');
+const elasticService = require('./ElasticService');
 
 const Router = async function (state) {
   const route = window.location.hash;
@@ -27,7 +27,7 @@ const Router = async function (state) {
           //Removing orcid.org to have better matches
           state.main.doc.id = state.main.doc.id.replace("http://orcid.org/0000-000", "");
           //state.main.doc.id = encodeURIComponent(state.main.doc.id);
-          const res = await solrService.search({api: state.config.api}, {
+          const res = await elasticService.search({api: state.config.api}, {
             start: 0,
             page: 1,
             searchParam: 'author_id%3A',
@@ -49,7 +49,7 @@ const Router = async function (state) {
       const start = splits[0] || state.main.start;
       const page = splits[1] || '';
       let searchText = splits[2] || '';
-      const {data, status} = await solrService.search({api: state.config.api}, {
+      const {data, status} = await elasticService.search({api: state.config.api}, {
         start: start,
         page: page,
         searchParam: 'main_search%3A',
@@ -72,7 +72,7 @@ const Router = async function (state) {
     }
   } else {
     // TODO: Move some of these config data to config
-    const res = await solrService.search({api: state.config.api}, {
+    const res = await elasticService.search({api: state.config.api}, {
       start: state.main.start,
       page: state.main.page,
       searchParam: '*%3A',
diff --git a/src/index.js b/src/index.js
index b604403..ffa4ce5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -39,7 +39,7 @@ let state = {
     viewFields: [
       {display: "SubDocHorizontal", field: "author", fieldName: 'Author/s'},
       //{display: "", field: "affiliation", fieldName: 'Affiliation'},
-      {display: "", field: "license", fieldName: 'Licence'},
+      {display: "", field: "licenseOriginal", fieldName: 'Licence'},
       {display: "SubDocDate", field: "datePublished", fieldName: 'Date Published'},
       {display: "SubDoc", field: "contactPoint", fieldName: 'Contact Point', template: '${item.name} ${item.email}'},
     ]
diff --git a/webpack.config.js b/webpack.config.js
index a62febd..f2a67cc 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -34,7 +34,8 @@ module.exports = {
     proxy: config.dev.proxy,
     historyApiFallback: {
       index: 'index.html'
-    }
+    },
+    clientLogLevel: 'debug'
   },
   module: {
     rules: [
-- 
GitLab