RoyDefined / WebDoomer

WebDoomer is a fast and efficient Zandronum and QZandronum server browser as a web app.
GNU General Public License v3.0
4 stars 0 forks source link

Search function #2

Open R3V3N93 opened 5 months ago

R3V3N93 commented 5 months ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like image

UI side

Describe alternatives you've considered

RoyDefined commented 5 months ago

Probably a good idea to start with this and eventually create a general search system allowing for multiple filters such as searching by wads and such. The main challenge with this is how I would fetch the actual servers that meet whatever criteria is being searched for.

To give an idea, the current system fetches a list of SQIDs that can be decoded into an IP and port: https://github.com/RoyDefined/WebDoomer/blob/09e2beb63d585c1cee263d337416b754a138851f/src/WebDoomerClient/src/app/stores/servers/servers.store.ts#L42

Then a list of servers is requested based on how many servers are visible in the virtual list that are unfetched: https://github.com/RoyDefined/WebDoomer/blob/09e2beb63d585c1cee263d337416b754a138851f/src/WebDoomerClient/src/app/stores/servers/servers.store.ts#L64

Finally the servers are patched with their new data and the list can show properly. You also got another step when you open the server details but this is unrelated.

I want to fetch as little data as possible in order to keep loading time at a minimum. What I could do is send a search criteria to the server, have the server filter the servers in memory, and then return just the SQID from these servers. Then the frontend can update the virtual list, which in turn triggers and asks for the list of servers which is now updated to show only the servers that meet the criteria.

I believe the fetching of servers works fine even if part of these servers are already fetched. The main thing I need to implement is a way to indicate what servers should actually shown and which ones are fetched/unfetched. Currently I just have a single list of fetched/unfetched servers and I use this for both the fetching of new servers and showing the servers. I can't use this because there would be no way to properly indicate what servers to show without throwing away the whole list.

RoyDefined commented 4 months ago

With 42eb7f9 stage 1 of the search feature has now been properly implemented. To comment on my previous comment here; I have decided to put this out in stages and not implement the second list as this is purely for improving the data size returned and this is already very little by itself. The rest of the system works exactly as specified, where search queries return a list of SQIDs and the virtual list will then fetch the servers it expects to show. In the second stage I can look into implementing this second list and possibly also introduce more filter features if fitting.