krisk / fuse-swift

A lightweight fuzzy-search library, with zero dependencies
MIT License
934 stars 112 forks source link

Swift 4 & bug fixes #5

Open Jake000 opened 6 years ago

Jake000 commented 6 years ago

I have updated the project to compile with no warnings with Xcode 9.2 using Swift 4. The biggest change from this was removing the 'characters' view from a string which was deprecated.

I have also fixed the following two issues I found from my usage:

  1. When searching through a long input (>100 characters) the library would trap from an integer overflow occurring in Fuse.swift, line 179. I added a test confirming this behaviour, and fixed it using the overflow safe operator.

  2. maxPatternLength was declared as a property but never actually used, making the search very slow for long inputs. I have used it when creating the pattern tuple in Fuse.swift, line 77.