@@ -11,7 +11,10 @@ Imagine how much is gained when the search functionality of your application res
11
11
## Getting Started
12
12
13
13
``` elixir
14
- Mix .install ([{:elasticlunr , " ~> 0.6" }])
14
+ Mix .install ([
15
+ {:kino , " ~> 0.4" },
16
+ {:elasticlunr , " ~> 0.6" }
17
+ ])
15
18
```
16
19
17
20
## What's an Index?
@@ -94,10 +97,12 @@ The search results is a list of maps and each map contains specific keys, `match
94
97
* ** ref:** this is the document id
95
98
* ** positions:** this is a map that shows the positions of the matching words in the document
96
99
97
- <!-- livebook:{"livebook_object":"cell_input","name":"Search","type":"text","value":"elixir"} -->
100
+ ``` elixir
101
+ search_query = Kino .Input .text (" Search" , default: " elixir" )
102
+ ```
98
103
99
104
``` elixir
100
- search_query = IO . gets ( " Search " )
105
+ search_query = Kino . Input . read (search_query )
101
106
results = Index .search (index, search_query)
102
107
```
103
108
@@ -177,10 +182,12 @@ documents = [
177
182
users_index = Index .add_documents (users_index, documents)
178
183
```
179
184
180
- <!-- livebook:{"livebook_object":"cell_input","name":"Search users","type":"text","value":"jason murry"} -->
185
+ ``` elixir
186
+ search_query = Kino .Input .text (" Search users" , default: " jason murry" )
187
+ ```
181
188
182
189
``` elixir
183
- search_query = IO . gets ( " Search users " )
190
+ search_query = Kino . Input . read (search_query )
184
191
Index .search (users_index, search_query)
185
192
```
186
193
0 commit comments