typesense-swift icon indicating copy to clipboard operation
typesense-swift copied to clipboard

Add `inFix`, `maxExtraPrefix` and `maxExtraSuffix` search parameters

Open programVeins opened this issue 2 years ago • 1 comments

Infix searching now works with the typesense-swift. Here's how to implement the same:

  1. Mark a field as infix: true in field defintion while creating the collection schema.
  2. Create search parameters with infix value to be either off, always or fallback. Use comma separated values to assign infix property to each of the query_by fields. Eg: SearchParameters(q: "abc", queryBy: "name,city,address", inFix: "off,always,off", maxExtraPrefix: 3) in this example, the infix assigned to each of the fields are -> name: off, city: always, address: off.
  3. Use maxExtraPrefix and maxExtraSuffix to fine tune the infix searching. If you want the query "DEF" to bring back the result "ABCDEF" then maxExtraPrefix should at least be 3. Suffix works similarly, but is used for characters after the query.

programVeins avatar Jan 29 '23 07:01 programVeins

Hi. So infix search is not available yet for swift?

ElDaRsh89 avatar May 02 '23 02:05 ElDaRsh89

Added in https://github.com/typesense/typesense-swift/pull/30

phiHero avatar Aug 05 '24 04:08 phiHero