From a410e8607b2ab9592c9367fce4d17803047c8ff3 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 18 Oct 2015 02:51:51 +0200 Subject: [PATCH] played with the search again. --- Handler/Search.hs | 11 ++++++++++- static/css/style-global.css | 10 ++++++++++ templates/result.hamlet | 15 +++++++-------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Handler/Search.hs b/Handler/Search.hs index 5777335..d2d6a2f 100755 --- a/Handler/Search.hs +++ b/Handler/Search.hs @@ -86,7 +86,16 @@ searchForm = renderDivs $ areq (searchField True) "Search" Nothing getResults :: Text -> Handler (Reply, Reply, Reply, Reply) getResults query = do - let esQuery = QuerySimpleQueryStringQuery (SimpleQueryStringQuery (QueryString query) Nothing Nothing Nothing Nothing Nothing 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 + } su <- runBH' $ searchByIndex (IndexName "user") $ mkSearch (Just esQuery) Nothing sa <- runBH' $ searchByIndex (IndexName "album") $ mkSearch (Just esQuery) Nothing sm <- runBH' $ searchByIndex (IndexName "medium") $ mkSearch (Just esQuery) Nothing diff --git a/static/css/style-global.css b/static/css/style-global.css index d0428d9..27b7917 100755 --- a/static/css/style-global.css +++ b/static/css/style-global.css @@ -198,6 +198,16 @@ /*custom*/ + #search > form + { + display: flex; + } + + #search > form .required > * + { + margin: 0; + } + a:hover { color: black; diff --git a/templates/result.hamlet b/templates/result.hamlet index 1c4a738..ae8d860 100755 --- a/templates/result.hamlet +++ b/templates/result.hamlet @@ -1,19 +1,18 @@
-
- ^{widget} - +

+ Results for: #{query} $if allEmpty
-

+

Sorry, no results $else $if not $ null userList
-

+

Results in Users: $forall (Entity uId user) <- userList
@@ -23,7 +22,7 @@ $else $if not $ null albumList
-

+

Results in Albums: $forall (Entity aId album) <- albumList
@@ -37,7 +36,7 @@ $else $if not $ null mediumList
-

+

Results in Media: $forall (Entity mId medium) <- mediumList
@@ -48,7 +47,7 @@ $else $if not $ null commentList
-

+

Results in Comments: $forall (Entity _ comment) <- commentList