Completly new search input with elastic realtime search. Handles keyboard inputs and autohides to not be in the way

This commit is contained in:
2019-06-04 22:48:41 +02:00
parent 3e92fbc626
commit b637cb3e08
3 changed files with 306 additions and 4 deletions

View File

@@ -91,5 +91,38 @@ const getEmoji = () => {
}
// - - - ELASTIC SEARCH - - -
// This elastic index contains titles mapped to ids. Lightning search
// used for autocomplete
export { getMovie, getShow, getListByName, search, searchTorrents, request, plexAuthenticate, getEmoji }
const elasticSearchMoviesAndShows = (query) => {
const url = `${ELASTIC_URL}shows,movies/_search`
const body = {
"sort" : [
{ "popularity" : {"order" : "desc"}},
"_score"
],
"query": {
"bool": {
"should": [{
"match_phrase_prefix": {
"original_name": query
}
},
{
"match_phrase_prefix": {
"original_title": query
}
}]
}
},
"size": 6
}
return axios.post(url, body)
.catch(error => { console.log(`api error searching elasticsearch: ${query}`); throw error })
}
export { getMovie, getShow, getListByName, search, searchTorrents, request, plexAuthenticate, getEmoji, elasticSearchMoviesAndShows }