Created
August 18, 2016 14:40
-
-
Save dasch/8d2b6bf0e1ecd170293ca5ea681857e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SearchQueryIndexer exposing (main) | |
import Stream exposing (Stream, Pipeline) | |
main : Pipeline | |
main = | |
Stream.readFrom "searches" | |
|> Stream.filter (\search -> search.resultCount > 0) | |
|> Stream.map .query | |
|> Stream.filter (\query -> String.length query > 10) | |
|> Stream.filter (\query -> String.length query < 50) | |
|> Stream.map normalizeQuery | |
|> Stream.writeTo "search-queries" | |
normalizeQuery : String -> String | |
normalizeQuery query = | |
String.toLower query |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment