Skip to content

Commit

Permalink
change order of algorithm/pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed May 25, 2017
1 parent eda200b commit d0516f6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -38,15 +38,6 @@ search("App");

Combined with libraries like [Moon](http://moonjs.ga), you can create a simple real-time search.

### Algorithm

The algorithm behind the search is fairly simple. First, a trie data structure is generated off of the data. When performing a search, the following happens:

* The search query is processed through the pipeline
* The search query is then tokenized into keywords
* Each keyword except the last is searched for and scores for each item in the data are updated according to the amount of keywords that appear in the document.
* The last keyword is treated as a prefix, and Wade performs a depth-first search and updates the score for all data prefixed with this keyword. The score is added depending on how much of the word was included in the prefix. This allows for searching as a user types.

### Pipeline

Wade uses a pipeline to preprocess data and search queries. By default, this pipeline will:
Expand All @@ -71,6 +62,15 @@ Wade.pipeline.push(function(str) {

All functions will be executed in the order of the pipeline (0-n) and they will be used on each document in the data.

### Algorithm

The algorithm behind the search is fairly simple. First, a trie data structure is generated off of the data. When performing a search, the following happens:

* The search query is processed through the pipeline
* The search query is then tokenized into keywords
* Each keyword except the last is searched for and scores for each item in the data are updated according to the amount of keywords that appear in the document.
* The last keyword is treated as a prefix, and Wade performs a depth-first search and updates the score for all data prefixed with this keyword. The score is added depending on how much of the word was included in the prefix. This allows for searching as a user types.

### License

Licensed under the [MIT License](https://kingpixil.github.io/license) by [Kabir Shah](https://kabir.ml)

0 comments on commit d0516f6

Please sign in to comment.