summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-03-11 14:22:02 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2017-03-11 14:22:02 +0100
commit5f51bd8bca61a5ad77d5680e8be9a2d96db9de91 (patch)
treea613ceb00ec954042bcc0837c62ab80895e6e6c4
parentc6afe44a13b76eea146266f928c0fcbfc3fb358a (diff)
downloadwww-andreasbaumann-cc-5f51bd8bca61a5ad77d5680e8be9a2d96db9de91.tar.gz
www-andreasbaumann-cc-5f51bd8bca61a5ad77d5680e8be9a2d96db9de91.tar.bz2
highlightin in title and in text (still buggy)
-rw-r--r--strus/document.ana4
-rw-r--r--themes/new_theme/layouts/partials/ranklist.html62
2 files changed, 60 insertions, 6 deletions
diff --git a/strus/document.ana b/strus/document.ana
index c63a175..c6b0dd1 100644
--- a/strus/document.ana
+++ b/strus/document.ana
@@ -11,12 +11,12 @@
thumbnail = orig content /posts/post/meta()/thumbnail();
[SearchIndex]
- word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/body//para();
word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/meta()/title();
+ word = lc:convdia(en):stem(en):lc regex("([A-Za-z']+)") /posts/post/body//para();
[ForwardIndex]
- text = orig split /posts/post/body//para();
title = orig split /posts/post/meta()/title();
+ text = orig split /posts/post/body//para();
#[MetaData]
# release_date = date2int("d 1877-01-01", "%Y-%m-%d %H:%M:%s *") content /posts/post/meta()/date;
diff --git a/themes/new_theme/layouts/partials/ranklist.html b/themes/new_theme/layouts/partials/ranklist.html
index 9e37ab4..9ed4877 100644
--- a/themes/new_theme/layouts/partials/ranklist.html
+++ b/themes/new_theme/layouts/partials/ranklist.html
@@ -81,19 +81,25 @@
for( var i = 0; i < data.ranklist.ranks.length; i++ ) {
var rank = data.ranklist.ranks[i];
var abstract = '';
- var title = 'No Title';
+ var title = '';
+ var title_attribute = 'No title';
var docid = '';
html += "<li>";
for( var j = 0; j < rank.attributes.length; j++ ) {
var attribute = rank.attributes[j];
if( attribute.key == 'title' ) {
- title = attribute.value;
+ title += ' ' + attribute.value;
+ } else if( attribute.key == 'title_attribute' ) {
+ title_attribute = attribute.value;
} else if( attribute.key == 'docid' ) {
docid = attribute.value;
- } else {
+ } else if( attribute.key == 'text' ) {
abstract += ' ' + attribute.value;
}
}
+ if( title == '' ) {
+ title = title_attribute;
+ }
html += "<div class='title'>"
html += "<a href=\"" + docid + "\">" + title + "</a></div>";
if( abstract != '' ) {
@@ -142,13 +148,55 @@
]
},
{
- attribute: "title",
+ attribute: "title_attribute",
name: "attribute",
params: [
{
key : "name",
value : "title"
}
+ ],
+ resultnames: [
+ {
+ key : "resultname",
+ value : "title_attribute"
+ }
+ ]
+ },
+ {
+ attribute: "title",
+ name: "test",
+ params: [
+ {
+ key: "type",
+ value: "title"
+ },
+ {
+ key: "match",
+ value: "feat"
+ },
+ {
+ key: "N",
+ value: 50
+ },
+ {
+ key: "add_dots",
+ value: 0
+ },
+ {
+ key: "start_first_match",
+ value: 0
+ },
+ {
+ key: "mark",
+ value: "<font color='black'>%1%</font>"
+ }
+ ],
+ resultnames: [
+ {
+ key: "resultname",
+ value: "title"
+ }
]
},
{
@@ -179,6 +227,12 @@
key: "mark",
value: "<b>%1%</b>"
}
+ ],
+ resultnames: [
+ {
+ key: "resultname",
+ value: "text"
+ }
]
}
]