Commit 0602e779 authored by Moritz Schepp's avatar Moritz Schepp
Browse files

added wiki pages to reindex

parent 0c54bea6
......@@ -134,15 +134,17 @@ declare function elastic:index-wiki-page($page, $locale) {
let $uri := string(base-uri($page))
let $doc_name := fn:tokenize($uri, '/')[6]
let $parts := fn:tokenize($doc_name, '[_\.]')
let $elastic_id := concat($parts[1], '_', $parts[2])
let $id := $parts[1]
let $locale := $parts[2]
let $elastic_doc_id := concat($id, '_', $locale)
let $doc := map {
"uri": $uri,
"id": $parts[1],
"locale": $parts[2],
"id": $id,
"locale": $locale,
"name": data($page//h1),
"search_data": fn:normalize-space(data($page))
}
return elastic:index-doc('wiki_pages', $elastic_id, $doc)
return elastic:index-doc('wiki_pages', $elastic_doc_id, $doc)
};
declare function elastic:to_json($data) {
......@@ -214,19 +216,28 @@ declare function elastic:setup() {
}}),
for $doc in collection(concat($config:app-root, '/templates/register'))//tei:person
return elastic:index-person($doc),
return elastic:index-person($doc),
for $doc in collection(concat($config:app-root, '/templates/register'))//tei:place
return elastic:index-place($doc),
return elastic:index-place($doc),
for $doc in collection(concat($config:app-root, '/templates/register'))//tei:item
return elastic:index-work($doc),
return elastic:index-work($doc),
for $doc in $editions_de/xhtml:div
return elastic:index-edition-page($doc, "de"),
return elastic:index-edition-page($doc, "de"),
for $doc in $editions_fr/xhtml:div
return elastic:index-edition-page($doc, "fr"),
return elastic:index-edition-page($doc, "fr"),
for $doc in collection(concat($config:app-root, '/docs'))//div[@id='wiki']
let $uri := string(base-uri($doc))
let $doc_name := fn:tokenize($uri, '/')[6]
let $parts := fn:tokenize($doc_name, '[_\.]')
let $locale := $parts[2]
let $revision := xs:integer(replace($parts[3], 'rev', ''))
order by $revision
return elastic:index-wiki-page($doc, $locale),
elastic:refresh()
]
......
......@@ -31,7 +31,6 @@ export class ArchSearchResult extends React.Component {
resultUrl() {
const source = this.props.data._source
// console.log(source)
if (this.isType('edition')) {
return 'view.html?edition=' + source.edition + '&page=' +
......@@ -53,15 +52,17 @@ export class ArchSearchResult extends React.Component {
highlights() {
const list = this.props.data.highlight.search_data || []
return list.map((e, i) => {
return(
<div
key={i}
className="pt-2 arch-text"
dangerouslySetInnerHTML={{__html: e}}
></div>
)
if (list.length == 0) {return ''}
const inner = list.map((e, i) => {
return <div
key={i}
className="pt-2 arch-text"
dangerouslySetInnerHTML={{__html: e}}
/>
})
return <div className="arch-highlights">{inner}</div>
}
name() {
......@@ -95,68 +96,26 @@ export class ArchSearchResult extends React.Component {
}
}
dataId() {
return this.props.data._source.id
}
render() {
return(
<a
className="arch-search-result d-block mb-3 p-3"
href={this.resultUrl()}
data-id={this.dataId()}
target="_blank"
rel="noopener"
onClick={this.clickMe}
>
<em className="arch-title" dangerouslySetInnerHTML={{__html: this.name()}} />
<div className="hi">
{this.highlights()}
</div>
<em
className="arch-title"
dangerouslySetInnerHTML={{__html: this.name()}}
/>
{this.highlights()}
</a>
)
}
}
// export function ArchSearchResult(props) {
// // const clickMe = function(event) {
// // console.log(props.data.type, props)
// // if (['edition', 'page'].indexOf(props.data.type) == -1) {
// // event.preventDefault()
// // openResult(props.data)
// // }
// // }
// let text = ''
// let s = props.data.summary
// if (s) {
// if (typeof s == 'string') {s = [s]}
// text = s.map((e, i) => {
// return(
// <div
// key={i}
// className="pt-2 arch-text"
// dangerouslySetInnerHTML={{__html: e}}
// ></div>
// )
// })
// } else if (props.data.text) {
// text = <p className="pt-2 arch-text">{tease(props.data.text, 200)}</p>
// }
// const url = resultUrl(props.data)
// let page = ''
// if (props.data.type == 'edition') {
// page = ` (${t('page')} ${props.data.page})`
// }
// return(
// <a
// className="arch-search-result d-block mb-3 p-3"
// href={url}
// target="_blank"
// rel="noopener"
// onClick={clickMe}
// >
// <em>{props.data.name || props.data.id}{page}</em>
// {text}
// </a>
// )
// }
......@@ -19,13 +19,16 @@ a.arch-search-result {
.arch-title {
display: block;
margin-bottom: 1em;
}
.arch-text {
color: $black !important;
}
.arch-highlights {
margin-top: 1em;
}
.hl {
background-color: #FFFFC7;
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment