Exclude List of Terms from Fuzzy/Wildcard Query

When performing a search with wild cards or a fuzzy term, it is possible to exclude terms or a subset of terms defined by wild cards or a fuzzy query.

Exclusion lists are supported only by the TBIE engine. The HAPI engine will return an 'Unexpected Operator' error whenever the exclusion list syntax is used. Similarly, the Audio bundle will return this error for the exclusion list use.

syntax

semantics

query - {exclusion_list_query_1, ..., exclusion_list_query_n}

 

  • in which query is a wild card search, e.g. ab* ; or a fuzzy search, e.g. constitution~2
  • if query does not have a wild card or fuzzy term, a syntax error will be returned
  • in which exclusion_list_query_n is a
    • term, e.g. apple ,
    • wild card search, e.g. ab* , or app[a-m]e , or app?e ,
    • fuzzy search, e.g. constitution~2
  • Empty term lists are allowed and will be ignored
    • A search query a* - { } will return all terms in a dictionary starting with a letter 'a'
  • Terms in the exclusion list should be separated by commas, otherwise a syntax error will be returned
  • Wild card query within the exclusion list cannot have an exclusion list
    • A search query a* - {abc*, avocado} is valid, but a search query a* - {avocado, ap* - {apple}} isn't allowed because ap* has an exclusion list with term 'apple', thus, an error will be returned: 'Error 4150: Unexpected nested exclusion list'.
  • Terms and wild card queries within exclusion lists may be quoted
    • A search query a* - {abc*, avocado} and "a*" - {"abc*", "avocado"} will return identical results
  • A wild card query with wild card queries in the exclusion lists might take longer than just the original wild card query
    • A search query a* - {abc*, *do} might take longer than a search query a*
  • An unquoted wild card query with an exclusion list must have a white space between the wild card query and the '-' symbol indicating introduction of the exclusion list. A quoted wild card query can omit the white space.
    • A search query a* - {avocado} is correct because '-' is preceded by a white space
    • A search query a*-{avocado} will be parsed as a single search term: "a*-{avocado}". Usually no results will be found.
    • A search query "a*"-{avocado} is correct because the wild card query is bordered by double quotes

 

Examples

Examples of allowed queries

  • o* - {olive, or*,other}
  • o* - {ol[a-m]ve, or*}
  • o* - {ol?ve, or*}
  • o* - {olive~2, *r)
  • *e - {olive}
  • *e - {or*, *ve}
  • *e - {ol[a-m]ve}
  • *e - {ol?ve}
  • *e - {olive~1, above}
  • constitution~4 - {constitution, cong*}
  • constitution~4 - {*o, constitution~2}
  • co* - {constitution~1, cohabitation, cong*, conb*}