Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev guideRecipesAPI Reference
Dev guideUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Filter

Introduces filtering in Optimizely Graph.

Filters are powerful tools for building a website. Filtering in Optimizely Graph lets you efficiently refine schema data using Logical Connectors and Geo Search. Navigational queries using operators and document filtering features let you refine output effectively.

Filtering in Optimizely Graph lets you refine query results by specifying the data's conditions. This means you can request only the relevant data you need, which improves performance and reduces the amount of unnecessary data transferred.

Filtering in GraphQL and Optimizely Graph involves using criteria to limit the data returned by a query. By applying filters, you can extract specific subsets of data that meet certain conditions, whether working with large databases or complex data structures. This targeted approach ensures that your application only processes and displays the necessary information, which is crucial for performance optimization and maintaining a clean user interface.

Filter operators in Optimizely Graph are essential tools that let you specify precise conditions for data retrieval, optimizing performance and user experience. The two ways you can filter using operators in Optimizely Graph include the following:

Exact filtering

  • eq (equals) – Filters data based on a single exact value. It is particularly useful for querying fields where you want to find entries that match a specific criterion, for example, filtering user records by a specific email address.
  • in – Lets you filter based on multiple exact values, effectively handling lists. It is ideal for scenarios where you must find entries that match any value within a specified set, such as retrieving products belonging to multiple specified categories.

Partial string filtering

  • startsWith – Lets you filter data by checking if a field starts with a particular string pattern. It is useful for searches that require prefix matching, such as finding user names that start with "John".
  • endsWith – Lets you filter data by matching the suffix of a string. It is effective for searches where you need to find entries ending with specific characters, such as file extensions or last names.

Filters are integral to creating dynamic, user-friendly websites. They let you build interfaces where users can find and interact with content based on their preferences and needs.

Key features of filters in Optimizely Graph

  1. Logical connectors – Used to combine multiple filtering conditions. Logical connectors such as AND, OR, and NOT let you do complex query logic, letting you apply multiple criteria simultaneously to refine your data further.
  2. Geo search – This feature enables filtering based on geographical data. Geo search is particularly useful for applications that need to provide location-based results, such as finding nearby stores or events.