Class SearchFacets

Represents an array of FacetGroups for searching

You can use multiple FacetGroups to combine them with an AND operation. Inside a FacetGroup, you can use multiple Facets to combine them with an OR operation.

// Search for projects with the category "forge" and the version "1.16.5" or "1.17.1"
const searchFacets = new SearchFacets(
// Combined with AND
new FacetGroup(
new Facet(FacetType.Categories, FacetOperation.EQUALS, "forge")
),
new FacetGroup(
// Combined with OR
new Facet(FacetType.Versions, FacetOperation.EQUALS, "1.16.5"),
new Facet(FacetType.Versions, FacetOperation.EQUALS, "1.17.1")
)
);

Constructors

  • Creates an array of FacetGroups for searching

    You can use multiple FacetGroups to combine them with an AND operation. Inside a FacetGroup, you can use multiple Facets to combine them with an OR operation.

    Parameters

    Returns SearchFacets

    // Search for projects with the category "forge" and the version "1.16.5" or "1.17.1"
    const searchFacets = new SearchFacets(
    // Combined with AND
    new FacetGroup(
    new Facet(FacetType.Categories, FacetOperation.EQUALS, "forge")
    ),
    new FacetGroup(
    // Combined with OR
    new Facet(FacetType.Versions, FacetOperation.EQUALS, "1.16.5"),
    new Facet(FacetType.Versions, FacetOperation.EQUALS, "1.17.1")
    )
    );

Methods

  • Stringifies the search facets

    Returns string

    The stringified search facets (e.g. [["categories:forge"], ["versions:1.16.5", "versions:1.17.1"]])