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
b58a59a4
Commit
b58a59a4
authored
4 years ago
by
Ole Voldsæter
Browse files
Options
Downloads
Patches
Plain Diff
refs meta#143 swagger.json + suggest-endpoint i API
parent
d1bd1057
No related branches found
Branches containing commit
Tags
release_2021-10-01_1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api_static/api/swagger.json
+106
-0
106 additions, 0 deletions
api_static/api/swagger.json
src/App.vue
+5
-15
5 additions, 15 deletions
src/App.vue
with
111 additions
and
15 deletions
api_static/api/swagger.json
0 → 100644
+
106
−
0
View file @
b58a59a4
{
"openapi"
:
"3.0.1"
,
"info"
:
{
"title"
:
"ordbok-cache"
,
"version"
:
"2020-02-17T12:44:25Z"
},
"servers"
:
[],
"paths"
:
{
"/article/{dict_id}/{art_id}"
:
{
"get"
:
{
"parameters"
:
[
{
"name"
:
"dict_id"
,
"in"
:
"path"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
},
{
"name"
:
"art_id"
,
"in"
:
"path"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
}
],
"security"
:
[
{
"api_key"
:
[]
}
]
}
},
"/article/{dict_id}/search"
:
{
"get"
:
{
"parameters"
:
[
{
"name"
:
"dict_id"
,
"in"
:
"path"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
},
{
"name"
:
"q"
,
"in"
:
"query"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
}
],
"security"
:
[
{
"api_key"
:
[]
}
]
}
},
"/article/{dict_id}/suggest"
:
{
"get"
:
{
"parameters"
:
[
{
"name"
:
"dict_id"
,
"in"
:
"path"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
},
{
"name"
:
"q"
,
"in"
:
"query"
,
"required"
:
true
,
"schema"
:
{
"type"
:
"string"
}
}
],
"security"
:
[
{
"api_key"
:
[]
}
]
}
}
},
"components"
:
{
"schemas"
:
{
"Empty"
:
{
"title"
:
"Empty Schema"
,
"type"
:
"object"
}
},
"securitySchemes"
:
{
"api_key"
:
{
"type"
:
"apiKey"
,
"name"
:
"x-api-key"
,
"in"
:
"header"
}
}
}
}
This diff is collapsed.
Click to expand it.
src/App.vue
+
5
−
15
View file @
b58a59a4
...
...
@@ -57,7 +57,7 @@ import SearchResults from './components/SearchResults.vue'
import
Autocomplete
from
'
@trevoreyre/autocomplete-vue
'
import
'
@trevoreyre/autocomplete-vue/dist/style.css
'
var
api_endpoint
=
'
https://ordbok
-dev.aws
.uib.no/
cache
/article
'
var
api_endpoint
=
'
https://
beta.
ordbok.uib.no/
api
/article
'
axios
.
interceptors
.
request
.
use
(
function
(
config
)
{
config
.
headers
[
"
x-api-key
"
]
=
"
ZkYiyRVXxH86ijsvhx3cH4SY5Iik2ijI3BKVJGMm
"
...
...
@@ -90,18 +90,8 @@ export default {
let
self
=
this
return
function
(
q
)
{
return
new
Promise
(
resolve
=>
{
return
axios
.
post
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/_search/
'
,
{
"
suggest
"
:
{
"
suggest
"
:
{
"
prefix
"
:
q
,
"
completion
"
:
{
"
field
"
:
"
suggest
"
,
"
size
"
:
10
}
}
}
}).
then
(
function
(
response
)
{
return
axios
.
get
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/suggest?q=
'
+
q
).
then
(
function
(
response
)
{
let
hits
=
q
.
length
?
[{
q
:
q
}]
:
[]
hits
=
hits
.
concat
(
response
.
data
.
suggest
.
suggest
[
0
].
options
.
sort
((
o1
,
o2
)
=>
o1
.
text
.
length
-
o2
.
text
.
length
))
resolve
(
hits
)
...
...
@@ -129,7 +119,7 @@ export default {
var
self
=
this
self
.
waiting
=
true
self
.
article
=
{
lemmas
:
[],
body
:{
pronunciation
:
[],
definitions
:
[],
etymology
:
[]}}
axios
.
get
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/
_
search?q=
'
+
event
.
q
+
'
'
+
event
.
q
+
'
*&size=20
'
)
axios
.
get
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/search?q=
'
+
event
.
q
+
'
'
+
event
.
q
+
'
*&size=20
'
)
.
then
(
function
(
response
){
self
.
$router
.
push
(
'
/
'
+
`/search?q=
${
event
.
q
}
&lang=
${
self
.
lang
}
`
)
self
.
search_results
=
response
.
data
.
hits
.
hits
...
...
@@ -164,7 +154,7 @@ export default {
this
.
lang
=
this
.
$route
.
params
.
lang
||
this
.
$route
.
query
.
lang
||
'
bob,nob
'
var
self
=
this
;
if
(
this
.
$route
.
query
.
q
)
{
axios
.
get
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/
_
search?q=
'
+
self
.
$route
.
query
.
q
+
'
'
+
self
.
$route
.
query
.
q
+
'
*&size=20
'
)
axios
.
get
(
api_endpoint
+
'
/
'
+
self
.
lang
+
'
/search?q=
'
+
self
.
$route
.
query
.
q
+
'
'
+
self
.
$route
.
query
.
q
+
'
*&size=20
'
)
.
then
(
function
(
response
){
self
.
search_results
=
response
.
data
.
hits
.
hits
self
.
waiting
=
false
...
...
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