From c2d26029ae5ada8d3eb4927e76d181f5c68339fc Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 22 Jan 2020 09:12:37 -0500 Subject: [PATCH] more comprehensive fix --- lib/philomena/comments/query.ex | 14 ++++++++++---- lib/philomena/posts/query.ex | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/philomena/comments/query.ex b/lib/philomena/comments/query.ex index 332ff199..4a3ace7f 100644 --- a/lib/philomena/comments/query.ex +++ b/lib/philomena/comments/query.ex @@ -26,10 +26,16 @@ defmodule Philomena.Comments.Query do :ok, %{ bool: %{ - must: %{term: %{anonymous: false}}, - should: [ - %{wildcard: %{author: data}}, - %{term: %{author: data}} + must: [ + %{term: %{anonymous: false}}, + %{ + bool: %{ + should: [ + %{term: %{author: data}}, + %{wildcard: %{author: data}} + ] + } + } ] } } diff --git a/lib/philomena/posts/query.ex b/lib/philomena/posts/query.ex index 7efb440f..bca23c4c 100644 --- a/lib/philomena/posts/query.ex +++ b/lib/philomena/posts/query.ex @@ -26,10 +26,16 @@ defmodule Philomena.Posts.Query do :ok, %{ bool: %{ - must: %{term: %{anonymous: false}}, - should: [ - %{wildcard: %{author: data}}, - %{term: %{author: data}} + must: [ + %{term: %{anonymous: false}}, + %{ + bool: %{ + should: [ + %{term: %{author: String.downcase(data)}}, + %{wildcard: %{author: String.downcase(data)}} + ] + } + } ] } }