stash icon indicating copy to clipboard operation
stash copied to clipboard

Filter Scenes by Stash Ids

Open sashapp opened this issue 1 week ago • 1 comments

Describe the feature you'd like

There is the GraphQL endpoint findScenes, which allows to query scenes by a number of settings.

  "A function which queries Scene objects"
  findScenes(
    scene_filter: SceneFilterType
    scene_ids: [Int!] @deprecated(reason: "use ids")
    ids: [ID!]
    filter: FindFilterType
  ): FindScenesResultType!

Using scene_filter.stash_id_endpoint, it is possible to query a scene by its Stash box id, like such:

query FindSceneById(
    $stashId: String
) {
    findScenes(
        scene_filter: {
            stash_id_endpoint: {
                stash_id: $stashId
                modifier: EQUALS
            }
        }
    ) {
        count
        scenes {
            ...SceneFragment
        }
    }
}

Unfortunately, the StashIDCriterionInput only allows to query for a single scene using a single id:

input StashIDCriterionInput {
  """
  If present, this value is treated as a predicate.
  That is, it will filter based on stash_ids with the matching endpoint
  """
  endpoint: String
  stash_id: String
  modifier: CriterionModifier!
}

However, I would like to map a list of Stash box ids to Stash app scenes.

Therefore, I am proposing to add a stash_ids_endpoint to the SceneFilterType, as follows:

input StashIDsCriterionInput {
  """
  If present, this value is treated as a predicate.
  That is, it will filter based on stash_ids with the matching endpoint
  """
  endpoint: String
  stash_ids: [String]
  modifier: CriterionModifier!
}

The resolver will attempt to resolve each id contained in stash_ids using the given modifier and endpoint.

What are your thoughts? Is this the way to implement this, or do you have a better idea?

Describe the benefits this would bring to existing users

The endpoint would allow to query a list of scenes by their stash ids with a single call, instead of having to make multiple calls to get all scenes by their Stash id.

Is there an existing way to achieve this goal?

This seems to be already possible by chaining many SceneFilterType via their OR field. Unfortunately, this creates deep nesting and is prohibitively expensive for the server, which will throw an exception when the nesting gets too deep.

Have you searched for an existing open/closed issue?

  • [x] I have searched for existing issues and none cover the core request of my proposal

Additional context

No response

sashapp avatar Dec 11 '25 14:12 sashapp

I've run into the same issue, would love to see this implemented

anonymous-ants avatar Dec 12 '25 09:12 anonymous-ants