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
System-provided initial compendium index fields #8776
Comments
Yeah, I think what I would like to do here is support pack-specific index fields to be defined as part of the compendium pack declaration in the module manifest file, for example:
This would only allow the package which initially provides a compendium pack to instruct the server to vend additional index fields, but I think that solves the primary use case without an excess of complexity. Would this solution satisfy your needs? |
Personally I envisioned it being available per subtype for an entire system (or for a V11 module that introduces new subtypes). As a system author I want the same index fields for whatever a content module introduces so that the new content can be integrated with features that utilize the index fields. The content module's author presumably wouldn't care what index fields are available for their own compendiums--though maybe there's a use case I'm not seeing for lack of first-hand experience making such modules. |
From the Lancer dev in Discord:
|
@cswendrowski can we get some clarification on the Lancer use case? I don't think I understand from the above quote. If the above proposed solution would not work for Lancer, is there an alternative solution that would? Or is Lancer just an un-solveable use case and they will have to manually request indices in-JS? |
Lancer generates compendiums on-the-fly from an external resource - Lancer has an official digital toolkit: https://compcon.app/#/ So long as it's possible to define |
For more context, part of the digital toolkit ecosystem for Lancer is content packs (renamed zip files). Both Comp/Con and the Foundry system can import those packs; for the system the items in the packs are used to generate or add to the compendiums. We decided it was the best UX to provide those compendiums on a world-by-world basis for a few reasons - sandboxing homebrew, avoiding users having to re-import everything each time the system updates, etc... cswendrowski is right, as long as we can define |
One alternative that is being considered instead of defining |
That would work perfectly fine for Lancer. Probably less prone to misuse, also. |
Can I please chime in and say that this feature request should not be happening please? People are already suffering from long load times due to the massive amount of data being sent on load (see #5942) and the indexing of compendiums is a way to send just the minimal data without saturating someone's network. While this would be great in theory for a use case of someone on localhost, or with a fiber optic internet, the reality is that many of Foundry's users are on low bandwidth, rural internet, and many worlds are rather large and made even larger by hundreds of MBs of compendium data. Something that many of us have been praying for is for Foundry to not even load all the content from the world db, as sending a multi-hundred MB database to the client on load can have devastating effects on load time of course, and it would be more efficient to only send an index and load documents as they are requested. This will of course never happen (or at least, not for years) since on the @stwlam's suggestion is (in his own words) "for skipping a second--moderately heavy--network request", but it would just mean that it would make the initial moderately heavy network request be even more moderately heavy! Sending a bigger index at the game load would not avoid the network request, it would just bundle it up in one initial blocking request. Basically, adding the ability to specify index fields for compendiums would be a step in the opposite direction of where we should ideally be.
What this issue plans on doing is
The pros/cons here are (in my personal opinion) quite obvious. and we all KNOW that there will be someone who will make the mistake of specifying every possible field they can. Heck, even @aaclayton's example actually puts the actor's biography in the list as an example, which would be catastrophic as it would be the largest amount of data in an actor's db. Imagine having to download 200MB of data on a rural internet connection because of a 'misconfiguration' of the index fields in a system. You may disagree with my assessment, but please do not make game loading even slower for users for the sake of "having everything ready right from the start" and to avoid doing a simple async operation after the game loads. |
Hey @kakaroto thanks for the thoughtfully worded reply. I agree with you that keeping the initial world load as small as possible has big advantages. The main proponent of this proposal and the primary use case we are trying to better support is PF2E (represented by @stwlam) who are currently using NEDB query language to retrive a subset of documents from compendium packs. With the NEDB query language going away in V11+ I've been working with them to scope alternative strategies. Most of these alternative strategies involve more use of compendium indices. After discussion with @stwlam, however, we both agree about your points regarding performance and I believe that they have agreed to pursue an alternative approach which would request expanded indices lazily at the latest possible moment in order to fulfill certain requests. I will leave it to @stwlam to confirm that this path forward is one that the PF2E system can commit to, and if so I am comfortable to close this issue as a "wontfix". |
Yeah, I'm fine with closing it. |
For what it's worth, while Lancer would like custom indices, I agree that it's more important for UX that the initial load is as fast as possible. |
Thanks for the consensus, folks. |
Thank you @aaclayton and @stwlam and others for reading and accepting my input on the matter! 🙇♂️ I hadn't realized this was for the pf2e query support. If you need to bounce ideas off me (or just acting as a debugging duck) to help find some kind of optimal alternate solution, I'd be more than happy to help! Just let me know |
I'm not sure that kakaroto's concerns are well founded, at least for the use case of Lancer. I created a new world, imported the core data as well as 9 additional content packs, refreshed the index then crunched an approximate for the amount of additional data this would add to the indices. This calculation assumes ascii encoded JSON with intact spaces and doesn't account for any compression, but it should be in the ballpark. The result I got was ~68KB or four orders of magnitude fewer than the 200MB unsourced estimate from kakaroto, which I don't think is at risk of doubling loading times. That said, any performance impact of this could be mitigated by limiting it to a single additional index field, rather than an array, which would be sufficient for Lancer's use case. Failing that, adding a new optional top-level field to Documents for content importers to use for identifying content would also be sufficient for lancer. |
That's your very specific use case. Trust me that there are thousands of users who have hundreds of MBs of compendium data. pf2e alone is 116MB and most pf2e users have other pf2e specific modules (bestiaries and whatever else) with even more hundreds of MBs of compendiums. I just recently had to help someone who was having trouble launching Foundry and it turned out that they had 1080 modules installed and 327 compendium packs enabled in their world (Foundry was taking 45 seconds just to list all the modules and parse their manifest and load their compendiums, before it starts listening on port 30000, which was enough for the initial request to timeout...)
add one additional index field and the next issue that gets created is someone saying they need to specify 2 fields. |
It's like 40 bytes per record once again assuming uncompressed json for lancer.
It forces every operation that involves the index to be async. |
I'm not even sure this still applies in a post-LevelDB world, but i will note that this issue has been tagged #wontfix and closed. Is there a particular reason you dredged it out of the archive to start arguing on it, 7 months later? |
In @BoltsJ defense:
For most systems with a "normal" amount of compendium data and "normal" use cases for indexing, this would be an almost trivial amount of additional overhead to add to the initial world load and would unlock the ability to use indices in powerful ways inside synchronous workflows like Actor or Item data preperation. We did close this issue as Some systems, like Pathfinder 2e as mentioned, are very large. PF2E currently clocks in by my check with around 60MB of compendium data (not the 116MB as mentioned above). It's possible this feature could be somehow limited to a reduced scope, or a maximum number of fields. |
User Experience
On initial load of the Foundry client, compendium index fields are a hard-coded set, and there is no API for altering them. If a system author wishes to have other (typically system data) fields included in actor or item indexes, they must edit the global
CONFIG
object from the client and then request new indexes from the server. Being able to provide compendium index fields from a system.json would allow for skipping a second--moderately heavy--network request.The text was updated successfully, but these errors were encountered: