Hi everyone, just wondering if it's possible to di...
# community-help
j
Hi everyone, just wondering if it's possible to disable the exclusion directive with
-
in search queries. How do you typically approach disabling this?
f
Hey JP, The tokenizer always treats
-
when it's the first character as a negation operator. You can't override this normally. Do your queries start with
-
?
j
Hi Fanis, I just realized I may have introduced a regression related to this when I updated a field-level schema setting. We have a search where you can input SKUs and some SKUs can have a
-
in them. One report has mentioned that anything after the last dash is being excluded from the search result, which makes sense now that I remember Typesense has something like this, which is why I opened this discussion. However, I just learned that in one environment, it is showing the expected result. The difference is the
symbols_to_index
I put to one field:
Copy code
{
  "facet": false,
  "index": true,
  "infix": false,
  "locale": "",
  "name": "sku",
  "optional": true,
  "sort": true,
  "stem": false,
  "stem_dictionary": "",
  "store": true,
  "symbols_to_index": [
    "/",
    ":",
    "-",
    " "
  ],
  "type": "string"
}
I removed it and it is showing result now for one specific result we are expecting to show. For what it's worth, we have a root level
symbols_to_index
like this which I attempted to override in field-level:
Copy code
"symbols_to_index": [
    "/",
    ":"
  ]
f
Hey JP, The order of the
query_by
fields dictates which
symbols_to_index
array will be used to Tokenize the query as well, meaning that if your first field has some
symbols_to_index
defined, those are going to be used on the query as well. Another thing to mention is that
symbols_to_index
don't cascade, but get outright overridden in the field level. So if your collection's
symbols_to_index
are
["-", ":", "/"]
and your field's are
["-". ":"]
, only those two will be used when indexing the document, and may or may not be used when querying, based on the order of the
query_by
fields.