fixed search

This commit is contained in:
nek0 2016-08-27 13:10:18 +02:00
parent c059b6df44
commit 258b92ec39

View file

@ -102,15 +102,23 @@ searchForm = renderDivs $ areq (searchField True) "Search" Nothing
getResults :: Text -> Handler (Reply, Reply, Reply, Reply) getResults :: Text -> Handler (Reply, Reply, Reply, Reply)
getResults query = do getResults query = do
esQuery <- return $ QueryFuzzyLikeThisQuery $ FuzzyLikeThisQuery -- esQuery <- return $ QueryFuzzyLikeThisQuery $ FuzzyLikeThisQuery
{ fuzzyLikeFields = [FieldName "_all"] -- { fuzzyLikeFields = [FieldName "_all"]
, fuzzyLikeText = query -- , fuzzyLikeText = query
, fuzzyLikeMaxQueryTerms = MaxQueryTerms 25 -- , fuzzyLikeMaxQueryTerms = MaxQueryTerms 25
, fuzzyLikeIgnoreTermFrequency = IgnoreTermFrequency False -- , fuzzyLikeIgnoreTermFrequency = IgnoreTermFrequency False
, fuzzyLikeFuzziness = Fuzziness 0.6 -- , fuzzyLikeFuzziness = Fuzziness 0.6
, fuzzyLikePrefixLength = PrefixLength 0 -- , fuzzyLikePrefixLength = PrefixLength 0
, fuzzyLikeBoost = Boost 1.0 -- , fuzzyLikeBoost = Boost 1.0
, fuzzyLikeAnalyzer = Nothing -- , 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 su <- runBH' $ searchByIndex (IndexName "user") $ mkSearch (Just esQuery) Nothing
sa <- runBH' $ searchByIndex (IndexName "album") $ mkSearch (Just esQuery) Nothing sa <- runBH' $ searchByIndex (IndexName "album") $ mkSearch (Just esQuery) Nothing