UI: add support for year specification in search
This commit is contained in:
parent
181719c6d9
commit
f964c0ceb9
1 changed files with 11 additions and 1 deletions
|
|
@ -170,6 +170,14 @@ type User = {
|
||||||
groups: Array<{ id: ULID }>
|
groups: Array<{ id: ULID }>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_query(query) {
|
||||||
|
const match = /^(.*?)(?:\s+([<=>])?(\d+|\(\d+\)))?$/.exec(query)
|
||||||
|
const title = match[1].replaceAll('"', "")
|
||||||
|
const comp = match[2] || ""
|
||||||
|
const year = match[3] ? /\d+/.exec(match[3])[0] : ""
|
||||||
|
return { title, year: year ? `${comp}${year}` : null }
|
||||||
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
data: () => ({
|
data: () => ({
|
||||||
query: "",
|
query: "",
|
||||||
|
|
@ -213,10 +221,12 @@ export default defineComponent({
|
||||||
const media_type = this.media_type === "" ? null : this.media_type
|
const media_type = this.media_type === "" ? null : this.media_type
|
||||||
const user_id = (this.filter_group === "" && this.credentials.user_id) || null
|
const user_id = (this.filter_group === "" && this.credentials.user_id) || null
|
||||||
const group_id = user_id === null && this.filter_group ? this.filter_group : null
|
const group_id = user_id === null && this.filter_group ? this.filter_group : null
|
||||||
|
const { title, year } = parse_query(this.query)
|
||||||
const more = await debounced_get(
|
const more = await debounced_get(
|
||||||
"movies",
|
"movies",
|
||||||
{
|
{
|
||||||
title: this.query,
|
title,
|
||||||
|
year,
|
||||||
per_page,
|
per_page,
|
||||||
include_unrated: true,
|
include_unrated: true,
|
||||||
page: this.page,
|
page: this.page,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue