About "query language" of `q`. I have a search fo...
# community-help
n
About "query language" of
q
. I have a search form using Typesense. My SearchParams and schema:
Copy code
{
        'q': searchTerm,
        'drop_tokens_threshold': 0,
        'num_typos': 0,
        'prefix': true,
        'filter_by': filterBy,
        'sort_by': sortBy,
        'query_by': query_by,
        'vector_query': vector_query,
        "rerank_hybrid_matches": true,
        'exclude_fields': 'embedding',
        'prioritize_num_matching_fields': false,
        'per_page': perPage,
        'page': pageNum
 }
 ...
 {
  "symbols_to_index": ["+", "/"],
  "token_separators": ["/", "-", "|"],
  "enable_nested_fields": true,
  "fields": [
    {
      "name":   "title",
      "type":   "string"
    },
   {
      "name":   "content_ind",
      "type":   "string"
    },
    {
      "name": "embedding",
      "type": "float[]",
      "embed": {
        "from": [
          "title",
          "content_ind"
        ],
        "model_config": {
          "model_name": "ts/jina-embeddings-v2-base-en"
        }
      }
    },
    ...
"search-as-you-type" not used - user should type a query in the query field (this goes in into
searchTerm
and into
q
) and press Enter. No special widget used, no InstantSearch.js, pure JS implementation calling "typesense" lib:
...documents().search( tsSearhParams )
User can select some filters in some dropdowns, can change sort order -> this changes
filterBy
,
sortBy
variables. User can select one of
semantic search
,
keyword search
,
hybrid search
in the UI -> this changes
query_by
and
vector_query
variables. And, to explain "query language" I wrote this end-user help text:
Copy code
Use "*" (wildcard operator) as the search string to return all elements.
Surround words with double quotes to do an exact phrase search. This works in "Hybrid search" and in "Keyword search" mode.
To exclude words in your query explicitly, prefix the word with the - operator. This works in "Hybrid search" and in "Keyword search" mode.
QUESTION: am I missing something? Is it a correct description ? Some other tricks? I think that "query language" changes depending on SearchParams ( Semantic search vs Keyword search query language?) and collection Schema. Would be great to have some explanation of this. Prodably - some kind of
Copy code
function generateQueryLanguageHelpString( SearchParams, Schema )
f
I'd suggest abstracting the wildcard syntax from the end user and just automatically send it if the query is empty. The rest of the description is correct
n
Thanks @Fanis Tharropoulos Yes, I am sending this "*" under the hood