Skip to main content

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.collectionfilter

Features

  • GET endpoint @faceted-search can be used like the ‘normal’ search-endpoint of the REST-Api @search, but it calculates and adds requested facets to the result set

  • GET endpoint can list all available and configured facets

  • POST endpoint @faceted-search can be used like the querystring search-endpoint of the REST-Api @querystring-search, but it calculates and adds requested facets to the result set

Documentation

GET endpoint

@faceted-search

This endpoint accepts all parameter of the ‘normal’ search endpoint of the REST Api like b_size, sort_on etc, and additionally three more: facets, facets_only and possible_facets. To get a list of all available and configured facets add parameter possible_facets=1 to the request. Choose one or more of the available facets and add them as stringlist parameter facets to 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 resultset

POST endpoint

@faceted-search

This endpoint accepts all parameter from the querystring-search endpoint of the REST Api, like query, sort_on etc, and additionally three more: facets, facets_only and possible_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 parameter facets to 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 resultset

Configuration of facets

Configuration is done by overloading collective.collectionfilter GroupByCriteria. <https://github.com/collective/collective.collectionfilter#overloading-groupbycriteria>

Examples

GET Request

http://localhost:8080/Plone/@faceted-search?b_size=24&SearchableText=Searchtext&facets=portal_type&facets=Subject

POST Request

http://localhost:8080/Plone/@faceted-search with 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"
  ]
}

Installation

Install collective.restapi.facetedsearch by adding it to your buildout:

[buildout]

...

eggs =
    collective.restapi.facetedsearch

and then running bin/buildout

Dependencies

All dependencies are installed automatically when installing collective.restapi.facetedsearch. Here is just a list of those for reference:

  • setuptools

  • plone.restapi

  • collective.collectionfilter

Contribute

License

The project is licensed under the GPLv2.

Contributors

Changelog

1.0.3 (2023-07-17)

1.0.2 (2023-07-05)

  • added some project description

1.0.1 (2022-06-02)

  • bugfix for empty query and empty resultset in post handler

  • removing limit in post handler

1.0.0 (2022-05-09)

  • Initial release. [muellers]

Metadata

Release files for collective.restapi.facetedsearch 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.restapi.facetedsearch 1.0.3
File Size Uploaded Provenance Actions
collective.restapi.facetedsearch-1.0.3.tar.gz 20.3 kB Without provenance Details for collective.restapi.facetedsearch-1.0.3.tar.gz

Release files / collective.restapi.facetedsearch-1.0.3.tar.gz

Download URL collective.restapi.facetedsearch-1.0.3.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aaf76110c2eb0f4b7b4c704eb8aacbb65cbf5737a0d406edcb98f42c58b2051c
BLAKE2b-256 checksum
How to use checksums
ccd602035296c4c0da1ab03596d35609964d03246e73c702fcffbe05724c67cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for collective.restapi.facetedsearch 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page