Skip to content
Snippets Groups Projects
Commit c3025d5e authored by esikkala's avatar esikkala
Browse files

Fix prefixes path

parent 42741686
No related branches found
No related tags found
No related merge requests found
import { runSelectQuery } from './SparqlApi'' import { has } from 'lodash'
import { runSelectQuery } from './SparqlApi'
import { jenaQuery } from './SparqlQueriesGeneral' import { jenaQuery } from './SparqlQueriesGeneral'
import { makeObjectList } from './SparqlObjectMapper' import { makeObjectList } from './SparqlObjectMapper'
import { fullTextSearchProperties } from './sampo/SparqlQueriesFullText'
export const queryJenaIndex = async ({ export const queryJenaIndex = async ({
backendSearchConfig, backendSearchConfig,
...@@ -10,9 +10,16 @@ export const queryJenaIndex = async ({ ...@@ -10,9 +10,16 @@ export const queryJenaIndex = async ({
resultFormat resultFormat
}) => { }) => {
let q = jenaQuery let q = jenaQuery
const endpoint = backendSearchConfig[resultClass].endpoint const config = backendSearchConfig[resultClass]
let endpoint
if (has(config, 'endpoint')) {
endpoint = config.endpoint
} else {
endpoint = backendSearchConfig[config.perspectiveID].endpoint
}
const { properties } = config
q = q.replace('<QUERY>', `?id text:query ('${queryTerm.toLowerCase()}' 2000) .`) q = q.replace('<QUERY>', `?id text:query ('${queryTerm.toLowerCase()}' 2000) .`)
q = q.replace('<RESULT_SET_PROPERTIES>', fullTextSearchProperties) q = q.replace('<RESULT_SET_PROPERTIES>', properties)
const results = await runSelectQuery({ const results = await runSelectQuery({
query: endpoint.prefixes + q, query: endpoint.prefixes + q,
endpoint: endpoint.url, endpoint: endpoint.url,
......
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
lastKnownLocationsAt lastKnownLocationsAt
} from './sparql_queries/SparqlQueriesPlaces' } from './sparql_queries/SparqlQueriesPlaces'
import { federatedSearchDatasets } from './sparql_queries/SparqlQueriesFederatedSearch' import { federatedSearchDatasets } from './sparql_queries/SparqlQueriesFederatedSearch'
import { fullTextSearchProperties } from './sparql_queries/SparqlQueriesFullText'
import { makeObjectList } from '../SparqlObjectMapper' import { makeObjectList } from '../SparqlObjectMapper'
import { mapPlaces } from '../Mappers' import { mapPlaces } from '../Mappers'
...@@ -21,7 +22,7 @@ export const backendSearchConfig = { ...@@ -21,7 +22,7 @@ export const backendSearchConfig = {
perspective2: perspective2Config, perspective2: perspective2Config,
perspective3: perspective3Config, perspective3: perspective3Config,
placesMsProduced: { placesMsProduced: {
perspectiveID: 'perspective1', perspectiveID: 'perspective1', // use endpoint config from perspective1
q: productionPlacesQuery, q: productionPlacesQuery,
filterTarget: 'manuscripts', filterTarget: 'manuscripts',
resultMapper: mapPlaces, resultMapper: mapPlaces,
...@@ -57,10 +58,8 @@ export const backendSearchConfig = { ...@@ -57,10 +58,8 @@ export const backendSearchConfig = {
} }
}, },
jenaText: { jenaText: {
endpoint: { perspectiveID: 'perspective1',
url: 'http://ldf.fi/mmm/sparql', properties: fullTextSearchProperties
useAuth: false
}
}, },
federatedSearch: { federatedSearch: {
datasets: federatedSearchDatasets datasets: federatedSearchDatasets
......
...@@ -2,7 +2,7 @@ import { ...@@ -2,7 +2,7 @@ import {
manuscriptPropertiesFacetResults, manuscriptPropertiesFacetResults,
manuscriptPropertiesInstancePage manuscriptPropertiesInstancePage
} from '../sparql_queries/SparqlQueriesPerspective1' } from '../sparql_queries/SparqlQueriesPerspective1'
import { prefixes } from './sampo/SparqlQueriesPrefixes' import { prefixes } from '../sparql_queries/SparqlQueriesPrefixes'
export const perspective1Config = { export const perspective1Config = {
endpoint: { endpoint: {
......
import { import {
workProperties workProperties
} from '../sparql_queries/SparqlQueriesPerspective2' } from '../sparql_queries/SparqlQueriesPerspective2'
import { prefixes } from './sampo/SparqlQueriesPrefixes' import { prefixes } from '../sparql_queries/SparqlQueriesPrefixes'
export const perspective2Config = { export const perspective2Config = {
endpoint: { endpoint: {
......
import { import {
eventProperties eventProperties
} from '../sparql_queries/SparqlQueriesPerspective3' } from '../sparql_queries/SparqlQueriesPerspective3'
import { prefixes } from './sampo/SparqlQueriesPrefixes' import { prefixes } from '../sparql_queries/SparqlQueriesPrefixes'
export const perspective3Config = { export const perspective3Config = {
endpoint: { endpoint: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment