now.executor.abstract.base_indexer.base_indexer module#

class now.executor.abstract.base_indexer.base_indexer.NOWBaseIndexer(dim, columns=None, metric='cosine', limit=10, traversal_paths='@c', max_values_per_tag=10, *args, **kwargs)[source]#

Bases: now.executor.abstract.auth.auth.get_auth_executor_class.<locals>.NOWAuthExecutor

Parameters
  • dim (int) – Dimensionality of vectors to index.

  • columns (Optional[List]) – List of tuples of the form (column_name, str_type). Here str_type must be a string that can be

parsed as a valid Python type. :type metric: str :param metric: Distance metric type. Can be ‘euclidean’, ‘inner_product’, or ‘cosine’ :type limit: int :param limit: Number of results to get for each query document in search :type traversal_paths: str :param traversal_paths: Default traversal paths on docs :type max_values_per_tag: int :param max_values_per_tag: Maximum number of values per tag (used for search), e.g. ‘@r’, ‘@c’, ‘@r,c’

open_query_to_filter(path)[source]#
get_tags_and_values(**kwargs)#
list(**kwargs)#
static set_doc_has_text_tag(docs)[source]#
index_endpoint(**kwargs)#
delete_endpoint(**kwargs)#
search_endpoint(**kwargs)#
curate(**kwargs)#
get_curated_matches(text_query=None)[source]#

Get curated matches for a given text query.

Return type

DocumentArray

create_matches(docs, parameters, traversal_paths, limit, retrieval_limit, search_filter)[source]#
append_matches_if_not_exists(docs_with_matches, docs_with_matches_to_add, limit)[source]#
merge_matches_by_score_after_half(docs_with_matches, docs_with_matches_to_add, limit)[source]#
static maybe_drop_blob_tensor(docs)[source]#

Drops blob or tensor from documents which have uri attribute set and whose ‘uri’ is a data-uri or is either in the cloud(S3) or can be loaded.

static clean_response(docs)[source]#

Removes embedding & OCR tags from the root level and also from the matches.

static parse_columns(columns)[source]#

Parse the columns to index

load_document_list()[source]#

is needed for the list endpoint

extend_inmemory_docs_and_tags(batch)[source]#

Extend the in-memory DocumentArray with new documents

delete_inmemory_docs_and_tags(docs)[source]#

Delete documents from the in-memory DocumentArray

update_inmemory_docs_and_tags(docs)[source]#

Update documents in the in-memory DocumentArray

construct(**kwargs)[source]#

Calls the constructor of the specialized indexer

batch_iterator()[source]#

Needs to be implemented in derived classes. Iterates over all documents in batches and yields them

convert_filter_syntax(search_filter={}, search_filter_not={})[source]#

Needs to be implemented in derived classes. Converts the filter syntax to the syntax of the specific indexer

index(docs, parameters, **kwargs)[source]#

Needs to be implemented in derived classes. Indexes the documents

delete(docs_to_delete, parameters, **kwargs)[source]#

Needs to be implemented in derived classes. Deletes the documents

search(docs, parameters, limit, search_filter, **kwargs)[source]#

Needs to be implemented in derived classes. Searches the documents