Cppinecone
A C++ client for the Pinecone vector database
filters.hpp File Reference

Filters supported by complex vector API operations. More...

#include <string>
#include "pinecone/types/vector_metadata.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

auto pinecone::types::filters::eq (std::string key, metadata_value value) noexcept -> binary_filter
 Equality filter, tests if a key is == to a value. More...
 
auto pinecone::types::filters::ne (std::string key, metadata_value value) noexcept -> binary_filter
 Not-equal filter, tests if a key is != to a value. More...
 
auto pinecone::types::filters::gt (std::string key, metadata_value value) noexcept -> binary_filter
 Greater-than filter, tests if a key is > than a value. More...
 
auto pinecone::types::filters::gte (std::string key, metadata_value value) noexcept -> binary_filter
 Greater-than-or-equal filter, tests if a key is >= a value. More...
 
auto pinecone::types::filters::lt (std::string key, metadata_value value) noexcept -> binary_filter
 Less-than filter, tests if a key is < a value. More...
 
auto pinecone::types::filters::lte (std::string key, metadata_value value) noexcept -> binary_filter
 Less-than-or-equal filter, tests if a key is <= a value. More...
 
template<typename iter >
auto pinecone::types::filters::in (std::string key, iter values) noexcept -> array_filter< iter >
 In filter, tests if a key is in a range of values. More...
 
template<typename iter >
auto pinecone::types::filters::nin (std::string key, iter values) noexcept -> array_filter< iter >
 Not-in filter, tests is a key is not in a range of values. More...
 
template<typename... ts>
auto pinecone::types::filters::and_ (ts... filters) noexcept -> combination_filter< ts... >
 And filter, tests if all contained filters are true. More...
 
template<typename... ts>
auto pinecone::types::filters::or_ (ts... filters) noexcept -> combination_filter< ts... >
 Or filter, tests is any contained filter is true. More...
 
auto pinecone::types::filters::none () noexcept -> no_filter
 No filter, always true. More...
 

Detailed Description

Filters supported by complex vector API operations.

All operations that accept metadata filters accept only a single top-level filter instance when the operation is dispatched; however, because of how these filters compose, it is possible to supply as many filters to an operation as you wish. For example, to find values with a "key" metadata value greater than 0 and less than 10, we would use the and combination filter with the gt and lt binary filters:

using namespace f = pinecone::types::filters;
auto gt0 = f::gt("key", 0);
auto lt0 = f::lt("key", 10);
auto filter = f::and_(gt0, lt10);
// now we can use filter with an API operation

Definition in file filters.hpp.

Function Documentation

◆ and_()

template<typename... ts>
auto pinecone::types::filters::and_ ( ts...  filters) -> combination_filter<ts...>
inlinenoexcept

And filter, tests if all contained filters are true.

Template Parameters
ts
Parameters
filters
Returns
combination_filter<ts...>

Definition at line 137 of file filters.hpp.

Referenced by pinecone::types::filters::and_().

◆ eq()

auto pinecone::types::filters::eq ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Equality filter, tests if a key is == to a value.

Parameters
key
value
Returns
binary_filter
Examples
metadata_filtering.hpp.

Definition at line 36 of file filters.hpp.

Referenced by pinecone::types::filters::eq().

◆ gt()

auto pinecone::types::filters::gt ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Greater-than filter, tests if a key is > than a value.

Parameters
key
value
Returns
binary_filter

Definition at line 60 of file filters.hpp.

Referenced by pinecone::types::filters::gt().

◆ gte()

auto pinecone::types::filters::gte ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Greater-than-or-equal filter, tests if a key is >= a value.

Parameters
key
value
Returns
binary_filter

Definition at line 72 of file filters.hpp.

Referenced by pinecone::types::filters::gte().

◆ in()

template<typename iter >
auto pinecone::types::filters::in ( std::string  key,
iter  values 
) -> array_filter<iter>
inlinenoexcept

In filter, tests if a key is in a range of values.

Template Parameters
iter
Parameters
key
values
Returns
array_filter<iter>

Definition at line 110 of file filters.hpp.

Referenced by pinecone::types::filters::in().

◆ lt()

auto pinecone::types::filters::lt ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Less-than filter, tests if a key is < a value.

Parameters
key
value
Returns
binary_filter

Definition at line 84 of file filters.hpp.

Referenced by pinecone::types::filters::lt().

◆ lte()

auto pinecone::types::filters::lte ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Less-than-or-equal filter, tests if a key is <= a value.

Parameters
key
value
Returns
binary_filter

Definition at line 96 of file filters.hpp.

Referenced by pinecone::types::filters::lte().

◆ ne()

auto pinecone::types::filters::ne ( std::string  key,
metadata_value  value 
) -> binary_filter
inlinenoexcept

Not-equal filter, tests if a key is != to a value.

Parameters
key
value
Returns
binary_filter

Definition at line 48 of file filters.hpp.

Referenced by pinecone::types::filters::ne().

◆ nin()

template<typename iter >
auto pinecone::types::filters::nin ( std::string  key,
iter  values 
) -> array_filter<iter>
inlinenoexcept

Not-in filter, tests is a key is not in a range of values.

Template Parameters
iter
Parameters
key
values
Returns
array_filter<iter>

Definition at line 124 of file filters.hpp.

Referenced by pinecone::types::filters::nin().

◆ none()

auto pinecone::types::filters::none ( ) -> no_filter
inlinenoexcept

No filter, always true.

Returns
no_filter

Definition at line 160 of file filters.hpp.

Referenced by pinecone::types::filters::none().

◆ or_()

template<typename... ts>
auto pinecone::types::filters::or_ ( ts...  filters) -> combination_filter<ts...>
inlinenoexcept

Or filter, tests is any contained filter is true.

Template Parameters
ts
Parameters
filters
Returns
combination_filter<ts...>
Examples
metadata_filtering.hpp.

Definition at line 150 of file filters.hpp.

Referenced by pinecone::types::filters::or_().