gws.base.search.finder¶
Base finder.
Source code: gws.base.search.finder
Module Contents¶
- class gws.base.search.finder.Config(*args, **kwargs)¶
Bases:
gws.ConfigWithAccessFinder configuration.
- models: list[gws.ext.config.model] | None¶
Models used to read the features.
- spatialContext: SpatialContext | None¶
Area searched by keyword searches without a user geometry.
- templates: list[gws.ext.config.template] | None¶
Templates to format the found features.
- class gws.base.search.finder.Object¶
Bases:
gws.FinderBase class for finders.
Reads the common finder options and decides whether a query can be run. Runs a query by reading the features through a model, within the area given by
context_shape. Subclasses declare which kinds of search they support and configure their models and templates, usingconfigure_modelsandconfigure_templates.- spatialContext: SpatialContext¶
Area searched by keyword searches without a user geometry.
- can_run(search, user)¶
Check if the finder can run a search query.
- Parameters:
search – Search query.
user – User running the search.
- Returns:
Trueif the finder can run the query.
- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- configure_models()¶
Create the models from the
modelsconfig.- Returns:
Trueif models are configured.
- configure_templates()¶
Create the templates from the
templatesconfig.- Returns:
Trueif templates are configured.
- context_shape(search: gws.SearchQuery) gws.Shape¶
Return the shape to search in.
This is the query shape if given. Otherwise, it is the query bounds if
spatialContextisview, or the bounds of the project map.- Parameters:
search – Search query.
- Returns:
The search shape, or
Noneif there is none.
- run(search, user, layer=None)¶
Run a search query.
- Parameters:
search – Search query.
user – User running the search.
layer – Layer the finder belongs to, if any.
- Returns:
Found features.