Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Oct 6, 2021
1 parent 99fcf0f commit 95450ef
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SearchBlock/SearchBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SearchBlockView from './SearchBlockView';
import config from '@plone/volto/registry';

const SearchBlockEdit = (props) => {
const schema = SearchBlockSchema({ formData: props.data });
const schema = SearchBlockSchema({ formData: props.data || {} });
const conf = config.settings.searchlib.searchui;
schema.properties.appName.choices = Object.keys(conf).map((k) => [
k,
Expand Down
2 changes: 1 addition & 1 deletion src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function SearchBlockView(props) {
data,
schema,
);
// console.log('registry', { data, registry });
console.log('registry', { data, registry });
return (
<div className="searchlib-block">
<SearchApp registry={registry} appName={appName} mode={mode} />
Expand Down
2 changes: 1 addition & 1 deletion src/SearchBlock/schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

export const SearchBlockSchema = ({ formData }) => ({
export const SearchBlockSchema = ({ formData = {} }) => ({
title: 'Searchlib Block',

fieldsets: [
Expand Down
3 changes: 3 additions & 0 deletions src/middleware/elasticsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function handleSearchRequest(req, res, params) {
const { body } = req;
const { urlES } = params;
const url = `${urlES}/_search`;
console.log('handle search', url, urlES);

superagent
.post(url)
Expand All @@ -41,6 +42,7 @@ function handleNlpRequest(req, res, params) {
const { endpoint } = body;
delete body.endpoint;
const url = `${urlNLP}/${endpoint}`;
console.log('handle nlp', url, urlNLP);

superagent
.post(url)
Expand Down Expand Up @@ -91,6 +93,7 @@ export const createHandler = ({ urlNLP, urlES }) => {

if (appName) {
const conf = config.settings.searchlib.searchui[appName];
console.log('conf', appName, conf.enableNLP);
handleSearch(req, res, next, {
appName,
urlNLP,
Expand Down

0 comments on commit 95450ef

Please sign in to comment.