Skip to content

Add a search function to find things in a collection #281

@joente

Description

@joente

Is your feature request related to a problem? Please describe.
Sometimes you just have a thingId, but no clue where the thing is attached in a collection.

Describe the solution you'd like
A search(..) function would be useful, the search function should work on a thing so you can narrow down the search when possible. The function should also accept a second argument to provide a limit and deep option. By default, both limit and deep should be 1. The function should return a list with results where each result is a new thing containing the parent, parent_type, key and key_type.

Describe alternatives you've considered
An alternative could be a function which always works on the whole collection; Attaching the search to a thing can do the same (by just typing .search(..), thus this makes it more useful.

Additional context
There is one downside, the function is not designed to be super fast and should not be misused but the main purpose of the function should be in case of debugging.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions