forked from DebaucheryLibrarian/traxxx
Using paginated full text search for movies, combined actor search and fetch to allow combining search with filters.
This commit is contained in:
@@ -100,26 +100,37 @@ function initReleasesActions(store, router) {
|
||||
};
|
||||
}
|
||||
|
||||
async function searchMovies({ _commit }, { query, limit = 20 }) {
|
||||
const { movies } = await graphql(`
|
||||
async function searchMovies({ _commit }, { query, limit = 20, pageNumber = 1 }) {
|
||||
const { connection: { movies, totalCount } } = await graphql(`
|
||||
query SearchMovies(
|
||||
$query: String!
|
||||
$limit:Int = 20,
|
||||
$limit:Int = 20
|
||||
$offset:Int = 0
|
||||
) {
|
||||
movies: searchMovies(
|
||||
connection: searchMoviesConnection(
|
||||
query: $query
|
||||
minLength: 1
|
||||
first: $limit
|
||||
offset: $offset
|
||||
orderBy: RANK_DESC
|
||||
) {
|
||||
${movieFields}
|
||||
movies: nodes {
|
||||
movie {
|
||||
${movieFields}
|
||||
}
|
||||
}
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
`, {
|
||||
query,
|
||||
limit,
|
||||
offset: Math.max(0, (pageNumber - 1)) * limit,
|
||||
});
|
||||
|
||||
return movies.map(movie => curateRelease(movie));
|
||||
return {
|
||||
movies: movies.map(({ movie }) => curateRelease(movie)),
|
||||
totalCount,
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchMovieById({ _commit }, movieId) {
|
||||
|
||||
Reference in New Issue
Block a user