From 258b92ec397bcbfc537ccacb4106d42e69743163 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 27 Aug 2016 13:10:18 +0200 Subject: [PATCH] fixed search --- Handler/Search.hs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Handler/Search.hs b/Handler/Search.hs index 39addb6..165227d 100755 --- a/Handler/Search.hs +++ b/Handler/Search.hs @@ -102,15 +102,23 @@ searchForm = renderDivs $ areq (searchField True) "Search" Nothing getResults :: Text -> Handler (Reply, Reply, Reply, Reply) getResults query = do - esQuery <- return $ QueryFuzzyLikeThisQuery $ FuzzyLikeThisQuery - { fuzzyLikeFields = [FieldName "_all"] - , fuzzyLikeText = query - , fuzzyLikeMaxQueryTerms = MaxQueryTerms 25 - , fuzzyLikeIgnoreTermFrequency = IgnoreTermFrequency False - , fuzzyLikeFuzziness = Fuzziness 0.6 - , fuzzyLikePrefixLength = PrefixLength 0 - , fuzzyLikeBoost = Boost 1.0 - , fuzzyLikeAnalyzer = Nothing + -- esQuery <- return $ QueryFuzzyLikeThisQuery $ FuzzyLikeThisQuery + -- { fuzzyLikeFields = [FieldName "_all"] + -- , fuzzyLikeText = query + -- , fuzzyLikeMaxQueryTerms = MaxQueryTerms 25 + -- , fuzzyLikeIgnoreTermFrequency = IgnoreTermFrequency False + -- , fuzzyLikeFuzziness = Fuzziness 0.6 + -- , fuzzyLikePrefixLength = PrefixLength 0 + -- , fuzzyLikeBoost = Boost 1.0 + -- , fuzzyLikeAnalyzer = Nothing + -- } + esQuery <- return $ QueryFuzzyQuery $ FuzzyQuery + { fuzzyQueryField = FieldName "_all" + , fuzzyQueryValue = query + , fuzzyQueryPrefixLength = PrefixLength 0 + , fuzzyQueryMaxExpansions = MaxExpansions 50 + , fuzzyQueryFuzziness = Fuzziness 0.6 + , fuzzyQueryBoost = Boost 1.0 } su <- runBH' $ searchByIndex (IndexName "user") $ mkSearch (Just esQuery) Nothing sa <- runBH' $ searchByIndex (IndexName "album") $ mkSearch (Just esQuery) Nothing