Package: collective.restapi.facetedsearch
This addon provides Plone-REST-Api endpoints for a faceted search. The GET endpoint is highly inspired by the REST-Api search and the POST endpoint is highly inspired by the REST-Api querystringsearch. Configuration of facets must be done by overloading GroupByCriteria of collective.collectionfilterFeaturesGET endpoint@faceted-searchcan be used like the ‘normal’ search-endpoint of the REST-Api@search, but it calculates and adds requested facets to the result setGET endpoint can list all available and configured facetsPOST endpoint@faceted-searchcan be used like the querystring search-endpoint of the REST-Api@querystring-search, but it calculates and adds requested facets to the result setDocumentationGET endpoint@faceted-searchThis endpoint accepts all parameter of the ‘normal’ search endpoint of the REST Api likeb_size,sort_onetc, and additionally three more:facets,facets_onlyandpossible_facets.
To get a list of all available and configured facets add parameterpossible_facets=1to the request.
Choose one or more of the available facets and add them as stringlist parameterfacetsto the request. The search response json will be extended with object property “facets”, and each of the facets contains a list with all item occurences of the facet in the resultset and the count how often they appear on the resultsetPOST endpoint@faceted-searchThis endpoint accepts all parameter from the querystring-search endpoint of the REST Api, likequery,sort_onetc, and additionally three more:facets,facets_onlyandpossible_facets. Provide the parameter in the request body as it is a post request.Choose one or more of the available facets and add them as stringlist parameterfacetsto the request.
The search response json will be extended with object property “facets”, and each of the facets contains a list with all item occurences of the facet in the resultset and the count how often they appear on the resultsetConfiguration of facetsConfiguration is done by overloading collective.collectionfilter GroupByCriteria.
<https://github.com/collective/collective.collectionfilter#overloading-groupbycriteria>ExamplesGET Requesthttp://localhost:8080/Plone/@faceted-search?b_size=24&SearchableText=Searchtext&facets=portal_type&facets=SubjectPOST Requesthttp://localhost:8080/Plone/@faceted-searchwith body:{
  "query": [

        {
          "i": "portal_type",
          "o": "plone.app.querystring.operation.selection.any",
          "v":
              ["stock", "person"]

      }
  ],
  "limit": 2000,
  "b_size": 2,
  "facets": [
      "tax_research_fields",
      "commentators",
      "location",
      "Subject"
  ]
}InstallationInstall collective.restapi.facetedsearch by adding it to your buildout:[buildout]

...

eggs =
    collective.restapi.facetedsearchand then runningbin/buildoutDependenciesAll dependencies are installed automatically when installing collective.restapi.facetedsearch.
Here is just a list of those for reference:setuptoolsplone.restapicollective.collectionfilterContributeIssue Tracker:https://github.com/collective/collective.restapi.facetedsearch/issuesSource Code:https://github.com/collective/collective.restapi.facetedsearch.gitDocumentation:https://docs.plone.orgLicenseThe project is licensed under the GPLv2.Contributorsmuellers,muellers@saw-leipzig.deChangelog1.0.3 (2023-07-17)moved git repository tohttps://github.com/collective/collective.restapi.facetedsearch; modified readme.rst and setup.py1.0.2 (2023-07-05)added some project description1.0.1 (2022-06-02)bugfix for empty query and empty resultset in post handlerremoving limit in post handler1.0.0 (2022-05-09)Initial release.
[muellers]