Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Margunn.Rauset
beta.ordbok.uib.no
Commits
7cd7b009
Commit
7cd7b009
authored
3 years ago
by
Henrik Askjer
Browse files
Options
Downloads
Patches
Plain Diff
Disable full-text search and reintroduce word router name
parent
91430e15
No related branches found
Branches containing commit
Tags
release_2021-11-24
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Autocomplete.vue
+17
-11
17 additions, 11 deletions
src/components/Autocomplete.vue
src/components/DictionaryView.vue
+23
-8
23 additions, 8 deletions
src/components/DictionaryView.vue
with
40 additions
and
19 deletions
src/components/Autocomplete.vue
+
17
−
11
View file @
7cd7b009
...
...
@@ -29,7 +29,7 @@
<span
class=
"search-hit"
>
{{
data
.
item
.
label
}}
</span>
(
{{
data
.
item
.
lang
?
data
.
item
.
lang
[
1
]
?
"
bm, nn
"
:
{
"
bob
"
:
"
bm
"
,
"
nob
"
:
"
nn
"
}
[
data
.
item
.
lang
[
0
]]
:
[
"
fulltekst
"
,
"
fritekst
"
,
"
avansert søk
"
][
data
.
item
.
mode
]
}}
)
(
{{
data
.
item
.
lang
?
data
.
item
.
lang
[
1
]
?
"
bm, nn
"
:
{
"
bob
"
:
"
bm
"
,
"
nob
"
:
"
nn
"
}
[
data
.
item
.
lang
[
0
]]
:
[
"
fulltekst
"
,
"
fritekst
"
,
"
avansert søk
"
][
data
.
item
.
search
]
}}
)
<
/template
>
<
template
slot
=
"
no-data
"
>
<
div
><
/div
>
...
...
@@ -80,33 +80,39 @@
if
(
this
.
items
[
0
])
{
if
(
this
.
items
[
0
].
time
<
time
)
{
if
(
/_|
\*
|
\|
/
.
test
(
q
))
{
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
,
label
:
q
,
time
:
time
,
mode
:
2
}
)
}
else
{
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
+
"
*
"
,
label
:
q
,
time
:
time
,
mode
:
1
}
)
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
,
label
:
q
,
time
:
time
,
search
:
2
}
)
}
else
{
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
+
"
*
"
,
label
:
q
,
time
:
time
,
search
:
1
}
)
}
}
}
else
{
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
+
"
*
"
,
label
:
q
,
time
:
time
,
mode
:
1
}
)
this
.
items
.
splice
(
0
,
1
,
{
q
:
q
+
"
*
"
,
label
:
q
,
time
:
time
,
search
:
1
}
)
}
let
self
=
this
self
.
api
.
get
(
'
suggest?
'
,
{
params
:
{
q
:
q
,
dict
:
self
.
$parent
.
lang
,
n
:
80
,
scope
:
'
n
f
'
}}
)
self
.
api
.
get
(
'
suggest?
'
,
{
params
:
{
q
:
q
,
dict
:
self
.
$parent
.
lang
,
n
:
80
,
scope
:
'
n
'
}}
)
.
then
(
async
(
response
)
=>
{
if
(
self
.
$refs
.
autocomplete
.
searchInput
==
q
&
self
.
suggesting
)
{
let
word_matches
=
response
.
data
.
a
.
n
.
map
(
item
=>
({
q
:
q
,
match
:
item
[
0
],
label
:
item
[
0
],
time
:
time
,
lang
:
item
[
1
]
}
))
let
text_matches
=
response
.
data
.
a
.
f
.
map
(
item
=>
({
q
:
q
,
match
:
item
[
0
],
label
:
item
[
0
],
time
:
time
,
mode
:
0
}
))
let
suggestions
=
response
.
data
.
a
.
n
.
map
(
item
=>
({
q
:
q
,
match
:
item
[
0
],
label
:
item
[
0
],
time
:
time
,
lang
:
item
[
1
]
}
))
/*
//let text_matches = response.data.a.f.map(item => ({q: q, match: item[0], label: item[0], time: time, search: 0
}
))
let suggestions = []
if( q.charAt(q.length-1) === '!') suggestions = text_matches.concat(word_matches)
else suggestions = word_matches.concat(text_matches)
*/
if
(
/_|
\*
|
\|
/
.
test
(
q
))
{
suggestions
.
unshift
({
q
:
q
,
label
:
q
,
time
:
time
,
mode
:
2
}
)
}
else
{
suggestions
.
push
({
q
:
q
+
"
*
"
,
label
:
q
+
'
'
,
time
:
time
,
mode
:
1
}
)
suggestions
.
unshift
({
q
:
q
,
label
:
q
,
time
:
time
,
search
:
2
}
)
}
else
{
suggestions
.
push
({
q
:
q
+
"
*
"
,
label
:
q
+
'
'
,
time
:
time
,
search
:
1
}
)
}
// whitespace necessary because duplicates aren't allowed in the dropdown
self
.
items
=
suggestions
...
...
This diff is collapsed.
Click to expand it.
src/components/DictionaryView.vue
+
23
−
8
View file @
7cd7b009
...
...
@@ -152,12 +152,11 @@ function navigate_to_search(self, query) {
}
*/
function
navigate_to_word
(
self
,
word
)
{
function
navigate_to_query
(
self
,
word
)
{
let
query
=
self
.
event
?
self
.
event
:
{
q
:
word
}
// Get article IDs
oda_api
.
get
(
'
articles?
'
,
{
params
:
{
lord
:
query
.
match
||
query
.
q
,
dict
:
self
.
lang
}}).
then
((
response
)
=>
{
oda_api
.
get
(
'
articles?
'
,
{
params
:
{
w
:
query
.
match
||
query
.
q
,
dict
:
self
.
lang
,
scope
:
"
n
"
}}).
then
((
response
)
=>
{
let
article_ids
=
response
.
data
let
unwrapped
=
[]
for
(
const
d
in
article_ids
)
{
...
...
@@ -246,9 +245,10 @@ export default {
methods
:
{
select_result
:
function
(
event
)
{
this
.
event
=
event
let
route
=
`/
${
this
.
lang
}
/search/
${
event
.
match
||
event
.
q
}
`
let
name
=
event
.
search
?
'
search
'
:
'
w
'
let
route
=
`/
${
this
.
lang
}
/
${
name
}
/
${
event
.
match
||
event
.
q
}
`
this
.
$router
.
push
(
route
)
navigate_to_
word
(
this
)
navigate_to_
query
(
this
)
// Tracking
let
props
=
{
query
:
event
.
q
}
...
...
@@ -259,9 +259,20 @@ export default {
},
update_lang_form
:
function
(
lang
)
{
this
.
lang
=
lang
let
route
=
`/
${
this
.
lang
}
/search/
${
this
.
$route
.
params
.
query
}
`
let
name
=
""
let
query
=
""
if
(
this
.
$route
.
name
==
'
word
'
)
{
name
=
"
w
"
query
=
this
.
$route
.
params
.
word
}
else
if
(
this
.
$route
.
name
==
'
search
'
)
{
name
=
"
search
"
query
=
this
.
$route
.
params
.
query
}
let
route
=
`/
${
this
.
lang
}
/
${
name
}
/
${
query
}
`
navigate_to_query
(
this
,
query
)
this
.
$router
.
push
(
route
)
navigate_to_word
(
this
,
this
.
$route
.
params
.
query
)
},
article_link_click
:
function
(
item
)
{
if
(
this
.
article
&&
this
.
article
.
article_id
==
item
.
article_id
){
...
...
@@ -299,7 +310,11 @@ export default {
self
.
waiting_for_metadata
=
false
if
(
self
.
$route
.
name
==
'
search
'
)
{
self
.
lang
=
self
.
$route
.
params
.
lang
navigate_to_word
(
self
,
self
.
$route
.
params
.
query
)
navigate_to_query
(
self
,
self
.
$route
.
params
.
query
)
}
else
if
(
self
.
$route
.
name
==
'
word
'
)
{
self
.
lang
=
self
.
$route
.
params
.
lang
navigate_to_query
(
self
,
self
.
$route
.
params
.
word
)
}
else
if
(
self
.
$route
.
name
==
'
lookup
'
){
navigate_to_article
(
self
,
self
.
$route
.
path
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment