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

Full text: update query, show note

parent cfd0b2c2
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ class MuiVirtualizedTable extends React.PureComponent { ...@@ -68,7 +68,7 @@ class MuiVirtualizedTable extends React.PureComponent {
cellRenderer = ({ cellData, columnIndex }) => { cellRenderer = ({ cellData, columnIndex }) => {
const { columns /* classes, rowHeight, onRowClick */ } = this.props const { columns /* classes, rowHeight, onRowClick */ } = this.props
const { id, valueType, makeLink, externalLink, sortValues, numberedList, minWidth } = columns[columnIndex] const { id, valueType, makeLink, externalLink, sortValues, numberedList, minWidth, collapsedMaxWords } = columns[columnIndex]
return ( return (
<ResultTableCell <ResultTableCell
columnId={id} columnId={id}
...@@ -80,7 +80,8 @@ class MuiVirtualizedTable extends React.PureComponent { ...@@ -80,7 +80,8 @@ class MuiVirtualizedTable extends React.PureComponent {
sortValues={sortValues} sortValues={sortValues}
minWidth={minWidth} minWidth={minWidth}
container='div' container='div'
expanded expanded={false}
collapsedMaxWords={collapsedMaxWords}
/> />
) )
}; };
...@@ -189,7 +190,7 @@ const rootStyle = { ...@@ -189,7 +190,7 @@ const rootStyle = {
} }
const tableContainer = { const tableContainer = {
width: 700, width: 1100,
height: '100%', height: '100%',
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto' marginRight: 'auto'
......
...@@ -23,12 +23,22 @@ export const INITIAL_STATE = { ...@@ -23,12 +23,22 @@ export const INITIAL_STATE = {
}, },
{ {
id: 'type', id: 'type',
valueType: 'string', valueType: 'object',
makeLink: false, makeLink: false,
externalLink: false, externalLink: false,
sortValues: false, sortValues: false,
numberedList: false, numberedList: false,
minWidth: 300 minWidth: 300
},
{
id: 'note',
valueType: 'string',
makeLink: false,
externalLink: false,
sortValues: false,
numberedList: false,
minWidth: 400,
collapsedMaxWords: 4
} }
], ],
fetching: false fetching: false
...@@ -62,13 +72,15 @@ const fullTextSearch = (state = INITIAL_STATE, action) => { ...@@ -62,13 +72,15 @@ const fullTextSearch = (state = INITIAL_STATE, action) => {
sortBy = action.sortBy sortBy = action.sortBy
sortDirection = 'asc' sortDirection = 'asc'
} }
const sortByProperty = state.properties.find(property => property.id === sortBy)
const sortByPath = sortByProperty.valueType === 'object' ? `${sortBy}.prefLabel` : sortBy
return { return {
...state, ...state,
sortBy, sortBy,
sortDirection, sortDirection,
results: orderBy( results: orderBy(
state.results, state.results,
sortBy === 'prefLabel' ? 'prefLabel.prefLabel' : sortBy, sortByPath,
sortDirection sortDirection
) )
} }
......
...@@ -677,10 +677,14 @@ export default { ...@@ -677,10 +677,14 @@ export default {
label: 'Type', label: 'Type',
description: '' description: ''
}, },
source: { note: {
label: 'Source', label: 'Note',
description: '' description: ''
} }
// source: {
// label: 'Source',
// description: ''
// }
} }
}, },
manuscripts: { manuscripts: {
......
...@@ -18,7 +18,7 @@ export const queryJenaIndex = async ({ ...@@ -18,7 +18,7 @@ export const queryJenaIndex = async ({
endpoint = backendSearchConfig[config.perspectiveID].endpoint endpoint = backendSearchConfig[config.perspectiveID].endpoint
} }
const { properties } = config const { properties } = config
q = q.replace('<QUERY>', `?id text:query ('${queryTerm.toLowerCase()}' 2000) .`) q = q.replace('<QUERY>', `(?id ?score) text:query ('${queryTerm.toLowerCase()}' 2000) .`)
q = q.replace('<RESULT_SET_PROPERTIES>', properties) q = q.replace('<RESULT_SET_PROPERTIES>', properties)
const results = await runSelectQuery({ const results = await runSelectQuery({
query: endpoint.prefixes + q, query: endpoint.prefixes + q,
......
...@@ -24,13 +24,11 @@ export const jenaQuery = ` ...@@ -24,13 +24,11 @@ export const jenaQuery = `
` `
export const fullTextQuery = ` export const fullTextQuery = `
SELECT ?id ?prefLabel__id ?prefLabel__prefLabel ?prefLabel__dataProviderUrl SELECT *
(SAMPLE(?type_) as ?type)
WHERE { WHERE {
<QUERY> <QUERY>
<RESULT_SET_PROPERTIES> <RESULT_SET_PROPERTIES>
} }
GROUP BY ?id ?prefLabel__id ?prefLabel__prefLabel ?prefLabel__dataProviderUrl
` `
export const facetResultSetQuery = ` export const facetResultSetQuery = `
......
export const fullTextSearchProperties = ` export const fullTextSearchProperties = `
{ {
VALUES ?type_uri { VALUES ?type__id {
frbroo:F4_Manifestation_Singleton frbroo:F4_Manifestation_Singleton
frbroo:F1_Work frbroo:F1_Work
frbroo:F2_Expression frbroo:F2_Expression
...@@ -16,8 +16,12 @@ export const fullTextSearchProperties = ` ...@@ -16,8 +16,12 @@ export const fullTextSearchProperties = `
crm:E53_Place crm:E53_Place
crm:E78_Collection crm:E78_Collection
} }
?id a ?type_uri . ?id a ?type__id .
?type_uri skos:prefLabel|rdfs:label ?type_ . ?type__id skos:prefLabel|rdfs:label ?type__prefLabel .
}
UNION
{
?id crm:P3_has_note ?note . # crm:P3_has_note has been added to text index
} }
UNION UNION
{ {
......
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