#community-help

Hybrid Search with Multiple Keyword Fields in the Book Store Schema

TLDR Akash wanted to use hybrid search on multiple keyword fields and inquired how to define embedding field. Kishore Nallan clarified there can only be one embedding field and suggested referring to certain documents.

Powered by Struct AI
Oct 16, 2023 (1 month ago)
Akash
Photo of md5-5a7e6fd9a070eac5034a6034f0dc38b1
Akash
11:27 AM
Kishore Nallan i want to use hybrid search with multiple keyword field like book_title,author ,publication can you suggest me what i should pass in query_by
 "searches": [
        {
          "query_by": "product_name,embedding",
          "q": "desktop copier",
          "collection": "products",
          "prefix": "false",
          "exclude_fields": "embedding",
          "per_page": 2
        }

Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:29 AM
There can be only one embedding field but can have multiple string fields for keyword search.
Akash
Photo of md5-5a7e6fd9a070eac5034a6034f0dc38b1
Akash
11:33 AM
Kishore Nallan only one embedding field means
11:35
Akash
11:35 AM
how we can define embedding field
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:41 AM
Akash
Photo of md5-5a7e6fd9a070eac5034a6034f0dc38b1
Akash
11:50 AM
Kishore Nallan books_schema = {
'name': collection_name,
'fields': [
{'name': 'bookId', 'type': 'int32','facet': True},
{'name': 'id', 'type': 'string'},
{'name': 'isbn', 'type': 'string','facet': True,'optional':True},
{'name': 'title', 'type': 'string'},
{'name': 'slug', 'type': 'string'},
{'name': 'isOutOfStock', 'type': 'string', 'facet': True},
{'name': 'author', 'type': 'string', 'facet': True},
{'name': 'bookCondition', 'type': 'string[]', 'facet': True, 'optional':True},
{'name': 'subject', 'type': 'string', 'facet': True, 'optional':True},
{'name': 'publication','type': 'string', 'facet': True,'optional':True},
{'name': 'category', 'type': 'string', 'facet': True},
{'name': 'qty', 'type': 'int32'},
{'name': 'bookDescription', 'type': 'string', 'optional':True},
{'name': 'binding', 'type': 'string', 'facet': True},
{'name': 'language', 'type': 'string', 'facet': True},
{'name': 'keywords', 'type': 'string
', 'facet': True, 'optional':True},
{'name': 'bookType', 'type': 'int32', 'facet': True},
{'name': 'iDate', 'type': 'int32'},
{'name': 'parentCategory', 'type': 'string', 'facet': True},
{'name': 'num_is_out_of_stack', 'type': 'int32'},
{'name': 'uDate', 'type': 'int32'},
{'name': 'mrp', 'type': 'int32', 'facet': True},
{'name': 'price', 'type': 'int32', 'facet': True},
{'name': 'discounPercent', 'type': 'int32', 'facet': True, 'optional':True},
{'name': 'cashbackPercent', 'type': 'int32', 'facet': True, 'optional':True},
{'name': 'agedGroup', 'type': 'string
', 'facet': True , 'optional':True},
{'name': 'imageUrl', 'type': 'string', 'facet': False},
{'name': 'categorySuggestion', 'type': 'string', 'facet': False , 'optional':True},
{'name': 'categoryPathId', 'type': 'string[]', 'facet': False,'optional':True},


],
"symbols_to_index": ["(", ")", "+", "?" ],

'default_sorting_field': 'bookId'
} this is book store schema i want to embeded title , categorySuggestion