"""Constants related to Vector order search. Note: all other field-specific constants are in separate modules. """ # 'order_by' field regexp: ORDER_BY_RE = r"-?[a-z]+[a-z0-9_]+" # JSON fields specific to the search endpoint. VO_TYPE_DELIVERY = "delivery" VO_TYPE_META_UPDATE = "meta_update" VO_TYPES = (VO_TYPE_DELIVERY, VO_TYPE_META_UPDATE) # Opensearch-specific constants. OS_VO_DETAIL_INDEX_NAME = "vectororder_detail_read" # Phrase quotes. ES_PHRASE_BOUNDARY = '"' # Sort by encoding_queue_detail_id by default. This is cheap and consistent sorting order. # encoding_queue_detail_id is integer vs _id is string. # By default, field data is disabled on text fields because it can consume large amounts of heap memory. DOCUMENT_SORT_FIELD = "encoding_queue_detail_id" # This field category names should match the expected kwargs of the # models.search.search_vector_order_details() function. VO_FIELD_CATEGORY_INNER_DISJUNCTION = "inner_disjunction" VO_STATUSES = "_statuses" VO_FIELD_CATEGORIES = { # Search fields that hold multiple values. "multiple": ( "priority", "display_upc", "product_id", "order_id", "status", "user_id", "encoder_id", "encoding_queue_id", "encoding", "delivery", "store_id", ), # Search fields that hold a singe value for a fulltext search. "fulltext": ("error_log",), # Search fields that hold a singe value. "single": ("meta_update",), "date_range": ( "created_at", "encoding_started", "encoding_ended", "delivery_started", "delivery_ended", ), VO_FIELD_CATEGORY_INNER_DISJUNCTION: (VO_STATUSES,), }