diff --git a/src/client/actions/index.js b/src/client/actions/index.js index e3094c45652ee42acb2d06fe0f1823946df5e3c7..154f8bffe2dadcf100a2671479d53d5a3841a25b 100644 --- a/src/client/actions/index.js +++ b/src/client/actions/index.js @@ -59,9 +59,9 @@ export const updatePaginatedResults = ({ resultClass, page, pagesize, data, spar type: UPDATE_PAGINATED_RESULTS, resultClass, page, pagesize, data, sparqlQuery }); -export const updateResults = ({ resultClass, data, sparqlQuery }) => ({ +export const updateResults = ({ resultClass, data, sparqlQuery, query, jenaIndex }) => ({ type: UPDATE_RESULTS, - resultClass, data, sparqlQuery + resultClass, data, sparqlQuery, query, jenaIndex }); export const sortResults = (resultClass, sortBy) => ({ type: SORT_RESULTS, diff --git a/src/client/components/facet_results/MaterialTableFullTextResults.js b/src/client/components/facet_results/MaterialTableFullTextResults.js index 60bdeffa0e5ed8629c51a4854bceed9e7e64be2e..95723c879a963ea2089344479b4119bd8cca5659 100644 --- a/src/client/components/facet_results/MaterialTableFullTextResults.js +++ b/src/client/components/facet_results/MaterialTableFullTextResults.js @@ -10,6 +10,7 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import CircularProgress from '@material-ui/core/CircularProgress'; import purple from '@material-ui/core/colors/purple'; +import Paper from '@material-ui/core/Paper'; import { has } from 'lodash'; const styles = () => ({ @@ -24,14 +25,15 @@ const styles = () => ({ class MaterialTableFullTextResults extends React.Component { + render() { - let resultText = this.props.data.length == 1 ? 'result' : 'results'; - //console.log(this.props.data) + const results = this.props.data; + let resultText = results == 1 ? 'result' : 'results'; if (this.props.fetching) { return ( - <div className={this.props.classes.progressContainer}> + <Paper className={this.props.classes.progressContainer}> <CircularProgress style={{ color: purple[500] }} thickness={5} /> - </div> + </Paper> ); } else { return ( @@ -71,9 +73,9 @@ class MaterialTableFullTextResults extends React.Component { } }, ]} - data={this.props.data} - title={this.props.data.length > 1 ? - `Search term: "${this.props.query}", ${this.props.data.length} ${resultText}` : + data={results} + title={results > 1 ? + `Search term: "${this.props.query}", ${results.length} ${resultText}` : '' } icons={{ diff --git a/src/client/containers/SemanticPortal.js b/src/client/containers/SemanticPortal.js index 352b5d424be8db351123a555b51eae838d8a9ddb..6f3b47fc22e275bda12a93bcbbed12ec7f68f927 100644 --- a/src/client/containers/SemanticPortal.js +++ b/src/client/containers/SemanticPortal.js @@ -295,12 +295,10 @@ let SemanticPortal = (props) => { </Grid> <Grid item xs={12} md={9} className={classes.resultsContainer}> - <Paper className={classes.resultsContainerPaper}> - <All - clientSideFacetedSearch={props.clientSideFacetedSearch} - routeProps={routeProps} - /> - </Paper> + <All + clientSideFacetedSearch={props.clientSideFacetedSearch} + routeProps={routeProps} + /> </Grid> </React.Fragment> } diff --git a/src/client/epics/index.js b/src/client/epics/index.js index 71c4f8184cf7eee65572426d896fa1fb5a11ff87..efff9a89c73b3259665669b656e23cdceefd1f16 100644 --- a/src/client/epics/index.js +++ b/src/client/epics/index.js @@ -160,9 +160,10 @@ const fetchResultsClientSideEpic = (action$, state$) => action$.pipe( return ajax.getJSON(requestUrl).pipe( map(response => updateResults({ resultClass: 'all', - jenaIndex: action.jenaIndex, + data: response.data, + sparqlQuery: response.sparqlQuery, query: action.query, - data: response + jenaIndex: action.jenaIndex })), catchError(error => of({ type: FETCH_RESULTS_FAILED, diff --git a/src/server/sparql/JenaQuery.js b/src/server/sparql/JenaQuery.js index e7ea37fdc19cf052155f499b79bc2654389d5cc5..16e20f70341fadb745ccbbcedd30665233a83b4f 100644 --- a/src/server/sparql/JenaQuery.js +++ b/src/server/sparql/JenaQuery.js @@ -5,16 +5,14 @@ import { makeObjectList } from './SparqlObjectMapper'; export const queryJenaIndex = async ({ queryTerm, - latMin, - longMin, - latMax, - longMax, + resultFormat }) => { let q = jenaQuery; q = q.replace('<QUERY>', ` - ?id text:query ('${queryTerm.toLowerCase()}' 10000) . + ?id text:query ('${queryTerm.toLowerCase()}' 2000) . `); - // console.log(prefixes + q) - const results = await runSelectQuery(prefixes + q, endpoint, makeObjectList); + console.log(prefixes + q) + const results = await runSelectQuery(prefixes + q, endpoint, makeObjectList, resultFormat); + console.log(results) return results; }; diff --git a/src/server/sparql/SparqlQueriesGeneral.js b/src/server/sparql/SparqlQueriesGeneral.js index c601f691ea1ebbb86be42701e6b58e4f4df49674..03ebada935872e9b47a0cb2139e70e56c4fbec0a 100644 --- a/src/server/sparql/SparqlQueriesGeneral.js +++ b/src/server/sparql/SparqlQueriesGeneral.js @@ -20,13 +20,16 @@ export const jenaQuery = ` BIND(STR(?type__prefLabel_) AS ?type__prefLabel) # ignore language tags OPTIONAL { ?id dct:source ?source__id . - OPTIONAL { ?source__id skos:prefLabel ?source__prefLabel_ } - BIND(COALESCE(?source__prefLabel_, ?source__id) as ?source__prefLabel) + BIND(?source__id AS ?source__prefLabel) + + # this used to work but now its painfully slow: + #OPTIONAL { ?source__id skos:prefLabel ?source__prefLabel_ } + #BIND(COALESCE(?source__prefLabel_, ?source__id) as ?source__prefLabel) } OPTIONAL { ?id mmm-schema:data_provider_url ?dataProviderUrl } - FILTER(?type__id != frbroo:F27_Work_Conception) + #FILTER(?type__id != frbroo:F27_Work_Conception) } `;