Skip to content

Commit

Permalink
full text search improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nczirjak-acdh committed Sep 21, 2020
1 parent 73f141e commit da9afec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion inst/dbfunctions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,15 @@ CASE
SELECT
DISTINCT(fts.id),
fts.property,
fts.raw,
CASE WHEN fts.property = 'BINARY' THEN
COALESCE(
(select mv.value from metadata_view as mv where mv.id = fts.id and mv.property = 'https://vocabs.acdh.oeaw.ac.at/schema#hasTitle' and mv.lang = _lang limit 1),
(select mv.value from metadata_view as mv where mv.id = fts.id and mv.property = 'https://vocabs.acdh.oeaw.ac.at/schema#hasTitle' and mv.lang = _lang2 limit 1),
(select mv.value from metadata_view as mv where mv.id = fts.id and mv.property = 'https://vocabs.acdh.oeaw.ac.at/schema#hasTitle' limit 1)
)
ELSE
fts.raw
END as raw,
CASE WHEN fts.property = 'BINARY' THEN
ts_headline('english', REGEXP_REPLACE(fts.raw, '\s', ' ', 'g'), to_tsquery(_searchstr), 'MaxFragments=1,MaxWords=5,MinWords=2')
ELSE ''
Expand Down

0 comments on commit da9afec

Please sign in to comment.