Interface QueryAgent
Agent providing means to answer queries for project-related FirstSpirit elements stored in its repository. The query API is simple and takes a simple text satisfying the query syntax. In general, it is about getting the QueryAgent (example script):
//!Beanshell import de.espirit.firstspirit.agency.QueryAgent; agent = context.requireSpecialist(QueryAgent.TYPE); hits = agent.answer("fs.uid = solar_concept_car", null); iHit = hits.iterator(); while (iHit.hasNext()) { hit = iHit.next(); print(hit); } hits.close();
Examples on the Mithras Energy demo project:
-
Find an element by UID:
fs.uid = solar_concept_car
-
Find a reference to a medium by name (requires using quotes):
"solar_concept_car MEDIASTORE_LEAF"
-
Find a medium or a reference to it by UID or name (combine using or):
"solar_concept_car MEDIASTORE_LEAF" or fs.uid = solar_concept_car
-
Find elements having a zoomable picture (set by a toggle gadget, st_picture_zoomable is the component
name):
st_picture_zoomable = true
-
Find elements having any content tags set (in meta data, md_content is a component name used in the
meta template):
meta.md_content = *
-
Find elements having no content tags set (in meta data, md_content is a component name used in the
meta template):
meta.md_content = ""
-
Find elements where meta data are defined:
fs.meta = 1
-
Find pictures having a minimum size (combined using "and"):
fs.width >= 468 and fs.height >= 60
-
Find media files by it crc value:
fs.crc = 1309123022
-
Find pictures outside a specific range (combined using "or"):
fs.width >= 1000 or fs.height >= 1000
-
Find elements having a specific type (related to
StoreElement.getElementType()
):
fs.type = Dataset and fs.type = Page
-
Find elements with a running workflow:
fs.workflow = *
(The content of the field "fs.workflow" is "workflow id
/workflow state id
") -
Find elements which are locked by a workflow:
fs.workflowLock = 1
- Since:
- 5.0.102
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpecialistType<QueryAgent>
Agent providing means to answer queries for project-related FirstSpirit elements stored in its repository. -
Method Summary
Modifier and TypeMethodDescription@NotNull Iterable<IDProvider>
Deprecated.@NotNull QueryResult
answer
(@NotNull String query, @Nullable QueryParameters parameters) Answers a given query by giving iterable access to matching FirstSpirit elements.
-
Field Details
-
TYPE
Agent providing means to answer queries for project-related FirstSpirit elements stored in its repository.- Since:
- 5.0.102
-
-
Method Details
-
answer
@NotNull @Deprecated(since="5.2.250502") @NotNull Iterable<IDProvider> answer(@NotNull @NotNull String query) Deprecated.since 5.2.250502, useanswer(String, QueryParameters)
insteadAnswers a given query by giving iterable access to matching FirstSpirit elements. The returned object provides continuous access to result elements until no more matching elements exist. To do so, it operates blocking, i.e., it will automatically wait for an answer to return from the server (if necessary).Note that each time the iterable object returned is accessed to read elements (i.e., an iterator object gets requested), a new search gets started. Note further that iterators provided do not support removing elements.
- Parameters:
query
- A formal description a result-eligible element has to match.- Returns:
- An object providing iterable access to result elements.
- Since:
- 5.0.102
-
answer
@NotNull @NotNull QueryResult answer(@NotNull @NotNull String query, @Nullable @Nullable QueryParameters parameters) Answers a given query by giving iterable access to matching FirstSpirit elements. The returned object provides continuous access to result elements until no more matching elements exist. To do so, it operates blocking, i.e., it will automatically wait for an answer to return from the server (if necessary).Note that each time the iterable object returned is accessed to read elements (i.e., an iterator object gets requested), a new search gets started. If no further results are required, the object should be closed in order to release resources. Note further that iterators provided do not support removing elements.
- Parameters:
query
- A formal description a result-eligible element has to match.parameters
- Additional parameters to refine the search. This parameter has been added for future use, for now developers should providenull
.- Returns:
- An object providing iterable access to result elements.
- Since:
- 5.2.250502
-
answer(String, QueryParameters)
instead