1.. add demo
WZQInstantSearch in a swift module designed for searching local documents with user-typed keywords in realtime.
An instance of WZQInstantSearch would build an improved Trie behind the scene and construct an index for further search.
let texts = ["An apple a day keeps the doctor away", "whose your daday", "I feel on top of world"] let wzq = WZQInstantSearch(texts)
For now, you can use wzq for any further search requirement.
wzq
Search
Suppose You just want to search something related with Apple, you just start typing An App, etc. You can use wzq instance to search as follows:
An App
let found = wzq.search("An App")
If as expected, the found will be an array with An apple a day keeps the doctor away in it.
found
In a nutshell, we use a combination of Trie and Index Array to develop this algorithm.
First Part: Build Trie with given texts
Second Part: Search by both whole text search and prefix search
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
WZQInstantSearch - An Algorithm For Instant Search
WZQInstantSearch in a swift module designed for searching local documents with user-typed keywords in realtime.
Usage
An instance of WZQInstantSearch would build an improved Trie behind the scene and construct an index for further search.
For now, you can use
wzq
for any further search requirement.Search
function to search related texts with your typed keywordsSuppose You just want to search something related with Apple, you just start typing
An App
, etc. You can usewzq
instance to search as follows:If as expected, the
found
will be an array with An apple a day keeps the doctor away in it.How does it work
In a nutshell, we use a combination of Trie and Index Array to develop this algorithm.
First Part: Build Trie with given texts
Second Part: Search by both whole text search and prefix search