krisk / fuse-swift

A lightweight fuzzy-search library, with zero dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String Comparison Crash

saru2020 opened this issue · comments

Hi,

Is there any reason why the below line of string comparison would lead to a crash?

    let result = fuse.search("Rancheras 2016 Borracho de Amor  Por Tu Maldito Amor  Hermoso Carino  Se Va Muriendo Mi Alma  Por un Amor", in: "Borracho De Amor")

fuse - comparison

fuse - crash

Any help would be appreciated. Thanks!

You have the arguments the other way around.

Your pattern is the first argument, and the string you are searching in is your second.

See here for reference.

@krisk The same bug happens randomly for me when the pattern is longer than the string (which happens often in my case but works fine most of the time). Should I prevent such usecase in my code? O is there going to be a release that will handle this case?