Interface QueryAgent


public 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");
     iHit = hits.iterator();
     while (iHit.hasNext()) {
         hit = iHit.next();
         print(hit);
     }
 

Examples on the Mithras Energy demo project:

  1. Find an element by UID:
    fs.uid = solar_concept_car
  2. Find a reference to a medium by name (requires using quotes):
    "solar_concept_car MEDIASTORE_LEAF"
  3. 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
  4. Find elements having a zoomable picture (set by a toggle gadget, st_picture_zoomable is the component name):
    st_picture_zoomable = true
  5. Find elements having any content tags set (in meta data, md_content is a component name used in the meta template):
    meta.md_content = *
  6. Find elements having no content tags set (in meta data, md_content is a component name used in the meta template):
    meta.md_content = ""
  7. Find elements where meta data are defined:
    fs.meta = 1
  8. Find pictures having a minimum size (combined using "and"):
    fs.width >= 468 and fs.height >= 60
  9. Find media files by it crc value:
    fs.crc = 1309123022
  10. Find pictures outside a specific range (combined using "or"):
    fs.width >= 1000 or fs.height >= 1000
  11. Find elements having a specific type (related to StoreElement.getElementType()):
    fs.type = Dataset and fs.type = Page
  12. Find elements with a running workflow:
    fs.workflow = *
    (The content of the field "fs.workflow" is "workflow id/workflow state id")
  13. Find elements which are locked by a workflow:
    fs.workflowLock = 1
To find more examples you may try drag and drop of items to the java client search field.
Since:
5.0.102
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Agent providing means to answer queries for project-related FirstSpirit elements stored in its repository.
  • Method Summary

    Modifier and Type
    Method
    Description
    answer(@NotNull String query)
    Answers a given query by giving iterable access to matching FirstSpirit elements.
  • Field Details

    • TYPE

      static final SpecialistType<QueryAgent> TYPE
      Agent providing means to answer queries for project-related FirstSpirit elements stored in its repository.
      Since:
      5.0.102
  • Method Details

    • answer

      @NotNull @NotNull Iterable<IDProvider> answer(@NotNull @NotNull String query)
      Answers a given query by giving iterable access to matching FirstSpirit elements. The returned object provides a 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