Update: Search now searches parent and grandparent titles too

pull/16/head
Juraj Nyíri 4 years ago
parent 40b6059453
commit dd37fe8493

@ -19958,7 +19958,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
let found = false;
// eslint-disable-next-line consistent-return
lodash.forEach(searchValues, value => {
if (!lodash.isEmpty(value) && lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(value))) {
if ((!lodash.isEmpty(value) && lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(value))) ||
lodash.includes(lodash.toUpper(movieData.parentTitle), lodash.toUpper(value)) ||
lodash.includes(lodash.toUpper(movieData.grandparentTitle), lodash.toUpper(value))) {
found = true;
return false;
}
@ -19967,7 +19969,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
shouldRender = true;
}
}
else if (lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(this.searchValue))) {
else if (lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(this.searchValue)) ||
lodash.includes(lodash.toUpper(movieData.parentTitle), lodash.toUpper(this.searchValue)) ||
lodash.includes(lodash.toUpper(movieData.grandparentTitle), lodash.toUpper(this.searchValue))) {
shouldRender = true;
}
if (shouldRender) {

@ -253,7 +253,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
let found = false;
// eslint-disable-next-line consistent-return
_.forEach(searchValues, value => {
if (!_.isEmpty(value) && _.includes(_.toUpper(movieData.title), _.toUpper(value))) {
if (
(!_.isEmpty(value) && _.includes(_.toUpper(movieData.title), _.toUpper(value))) ||
_.includes(_.toUpper(movieData.parentTitle), _.toUpper(value)) ||
_.includes(_.toUpper(movieData.grandparentTitle), _.toUpper(value))
) {
found = true;
return false;
}
@ -261,7 +265,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (found || _.isEmpty(searchValues[0])) {
shouldRender = true;
}
} else if (_.includes(_.toUpper(movieData.title), _.toUpper(this.searchValue))) {
} else if (
_.includes(_.toUpper(movieData.title), _.toUpper(this.searchValue)) ||
_.includes(_.toUpper(movieData.parentTitle), _.toUpper(this.searchValue)) ||
_.includes(_.toUpper(movieData.grandparentTitle), _.toUpper(this.searchValue))
) {
shouldRender = true;
}
if (shouldRender) {

Loading…
Cancel
Save