Skip to content
/ Ifrit Public

Swfit library for fuzzy search. No dependencies lib.

License

Notifications You must be signed in to change notification settings

ukushu/Ifrit

Repository files navigation

Ifrit

https://github.com/ukushu/Ifrit.git
[email protected]:ukushu/Ifrit.git

What is Ifrit?

Ifrit is fuzzy search library written in pure swift.

What is fuzzy Search?

A fuzzy search algorithm is designed to find approximate matches for a given search query.

Let's say you have a list of products, and a user is looking for a "Czy Swetr,". Exact match will return nothing, but the fuzzy search will find "Cozy Sweater.".

If you need exact match - you need to use standard function .filter { } instead of this library.

Demo of Fuzzy Search:

Ifrit demo

Advanteges / Disadvantages of Ifrit

Advanteges:
+ Super lightweight
+ No dependencies
+ OS supported: MacOS(>=v10_15), iOS(>=v13), visionOS, watchOS, twOS, Linux
+ Asynchronous search ( async/await + callbacks both )
+ Text highlight support (AttributedString)
+ Covered with automated tests
+ MIT Licensed
+ Ability to link Ifrit as Static and Dynamic package - choose what is better in your case

Disadvantages:
- Wasn't tested in production
- Swift 5.9 and higher, older version of Swift does not supported.

This repository is based on archived repository Fuse-Swift by KRisk: https://github.com/krisk/fuse-swift

Swift Package Index information: https://swiftpackageindex.com/ukushu/Ifrit

Difference: Ifrit VS Fuze-Swift?

+ Fuze-Swift support Pods and Packages :)
- Ifrit supports only Packages :(

- Fuze-Swift is dead :(
+ Ifrit is a Fuse-Swift reborn from hell and ALIVE as ever :)

- Fuze-Swift supports async functins with callbacks, but does not support async/await
+ Ifrit supports callbacks and async/await both:)

- Fuze-Swift have async/multithreading issues. Crashes is possible :(
+ Ifrit is a Fuze-Swift with fixed multithreading issues - no crashes :)

- Fuze-Swift async functions returns incorrect results (wrong indexes) :((((
+ Ifrit's async functins returns correct indexes and covered with tests :)

- Fuze-Swift written for xcode 11 and have a lot of warnings at now :(
+ Ifrit code is updated to swift's latest standards and there are no build warnings :)

+ Ifrit - extended coverage with automated tests in general :)
+ Ifrit have additional search system using Levenstain distance algorythm :)
+ Ifrit have ability to search by several templates
+ Ifrit have a little bit changed syntax to be more flexible.
+ Ifrit's sync search faster than Fuse's on 2% (standard settings) using M1 processor.
+         Async search have tha same speed (standard settings).

Contributing

Ifrit welcomes contributions in the form of GitHub issues and pull-requests.

Installation

  1. XCode -> Menu Line -> Add Package Dependencies -> https://github.com/ukushu/Ifrit.git

  2. import Ifrit to your source files.

Documentation / Instructions / Example Project

Ifrit repository have no example project. Use instructions below:

How to use Ifrit's Fuse

How to use Ifrit's Levenstain

How to display search results in UI

🇺🇦🇺🇦🇺🇦 UKRAINE NEEDS YOUR SUPPORT! 🇺🇦🇺🇦🇺🇦

Mariupol city before Russia invasion (2021):

Mariupol city after Russia invasion (2022):

( ruined almost all infrastructure )

Destruction of the Kakhovka Dam

Russia destroyed Kakhovka Dam in the early hours of 6 June 2023 in Kherson Oblast. This was the second-largest reservoir in Ukraine by area (2,155 km2 [832 sq mi]) and the largest by water volume (18.19 km3 [4.36 cu mi]). According to Ukrainian military intelligence, Russian forces carried out "major mining" of the Kakhovka dam shortly after taking control in February 2022, and in April 2022 mined locks and supports and installed "tented trucks with explosives on the dam itself". In October 2022, the Foreign Minister of Moldova, Nicu Popescu, said that Ukraine had intercepted Russian missiles targeting a different dam, on the Dniester river. At the time, Ukrainian president Zelenskyy warned of Russian preparations to destroy the Kakhovka dam and blame Ukraine, and called for an international observation mission at the dam to prevent a potential catastrophe.

The capacity of the Kakhovka reservoir was 18 million cubic meters of fresh water.

This reservoir could have provided all people on the planet with fresh water for more than 2 years. And this water was lost.

Not to mention the flooded residential areas and the environmental disaster caused by the washing away of cemeteries and desalination of water in the Black Sea.