Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds search by genre to WebUI #238

Merged
merged 3 commits into from
Feb 16, 2023
Merged

Conversation

akabhirav
Copy link
Contributor

@akabhirav akabhirav commented Feb 12, 2023

What

As the title says, this feature will allow you to use the search input with genre as well. You can input comma separated genre to search by them
Note: You need to put the full genre text (case does not matter)

Why

Searching by genre is very cool, it has the ability to give you exactly what you are in the mood for. Want something that has a lot of action in it, but also monsters. Type in action, monster and it will give you all the mangas in your library that are tagged with them
Disclaimer: Search by genre is subject to information provided by extension and sources. So if your source/extension does not provide proper genre details, this will not work

Comment on lines +58 to +66
const titleFilteredManga = manga.filter((m) => queryFilter(query, m));
const genreFilteredManga = manga.filter((m) => queryGenreFilter(query, m));
const unique = titleFilteredManga.concat(genreFilteredManga).reduce((acc: Record<number, IMangaCard>, obj) => {
const { id } = obj;
if (!acc[id]) {
acc[id] = obj;
}
return acc;
}, {});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will keep the mangas that matched by title above the ones that matched by genre. I am working on a more streamlined version that gives a rank to manga objects while filtering, and sorts accordingly. Could be more performant

@@ -63,15 +64,12 @@ const filterManga = (
}
return acc;
}, {});
return Object.values(unique);
filteredManga = Object.values(unique);
Copy link
Collaborator

@schroda schroda Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit reverts #226.
not sure how everyone else sees this, but I'd like to be able to search my whole library and not just the filtered one (e.g. downloaded, unread), since otherwise, if you want to open a manga that is not included in the filters, you have to unset the filters everytime you search for something like that (and set them again after you've found the manga)

Copy link
Contributor Author

@akabhirav akabhirav Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not how the app works? If you want to search something that is not downloaded then you remove the filter and search for it, right?

It felt like a bug that my filters were not being honored when I searched for my manga

I believe we should stick close to the app implementation. If setting and unsetting the filters are cumbersome or buggy we could improve the experience there. I will adhere to the consensus. But, I think we should keep this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never used the app (don't have an android), so I can't say.

I guess it's preference. I expected it to search my whole library (or at least the category, since whole library is not possible).
since I know what I'm searching for (a specific title), I wouldn't want a filter to mess with it.

if it should work like the app, what about adding some kind of flag to search all mangas/ignore filters?

Copy link
Contributor Author

@akabhirav akabhirav Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a good workaround, but for that we need to clarify the following details

  1. Whether this preference will be stored in localStorage or sever [Probably server, but putting this in server, would need input from others]
  2. Where can users find this preference(Settings page or somewhere else) [ Probably Settings page ]
  3. Will it be on/off by default [I prefer off, i.e. search will respect filter as OOB experience]
  4. Any other solutions like displaying a fab while searching and if filters are active, to quicky disable the filters(either for that search or permanently) [I like this idea, but will take much more time/brain to implement]
  5. Should it be done in this PR or another [I prefer another PR]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schroda any opinions on these? I'd like to get this PR reviewed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'd say server as well
  2. maybe the library "settings" (filter, sort, ui), or a settings button inside the search, which is only visible when search is open?
  3. should be the same as the app then, so disabled
  4. I wouldn't mess with the filters, since it's also not really required for it to work
  5. yes, should be done in another pr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schroda I have created a new PR #242 to find a solution for the issue in this thread

@AriaMoradi AriaMoradi merged commit 5473d14 into Suwayomi:master Feb 16, 2023
@akabhirav akabhirav deleted the genre-search branch February 24, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants