Hi! I'm working with a version 8.18.8 Umbraco site right now which has a search function on the site, but discovered a bug where the search does not handle dashes. Anytime you try to search for only "-" or anything including "-" there are simply 0 results. Is this a known bug or a known case that needs to be handled?
Having a hard time finding what would cause this as there's currently no code specifically for handling dashes.
if (!ExamineManager.Instance.TryGetSearcher("FacetSearcher", out ISearcher searcher))
{
throw new InvalidOperationException($"No searcher found with name FacetSearcher");
}
searchTerm = searchTerm.MakeSearchQuerySafe();
var headerFields = new[] { "nodeName", "contentHeader", "cardHeader" };
var contentFields = new[] { "content", "contentText", "contentPreamble", "cardText", "metaDescription" };
var criteria = searcher.CreateQuery(null, BooleanOperation.Or);
var examineQuery = criteria.Field("contentHeader", searchTerm.MultipleCharacterWildcard())
.Or().Field("cardHeader", searchTerm.MultipleCharacterWildcard())
.Or().Field("nodeName", searchTerm.MultipleCharacterWildcard())
.Or().Field("cardText", searchTerm.MultipleCharacterWildcard())
.Or().Field("content", searchTerm.MultipleCharacterWildcard())
.Or().Field("contentPreamble", searchTerm.MultipleCharacterWildcard())
.Or().Field("contentText", searchTerm.MultipleCharacterWildcard())
.Or().Field("blocks", searchTerm.MultipleCharacterWildcard());
Examine search not able to handle dashes?
Hi! I'm working with a version 8.18.8 Umbraco site right now which has a search function on the site, but discovered a bug where the search does not handle dashes. Anytime you try to search for only "-" or anything including "-" there are simply 0 results. Is this a known bug or a known case that needs to be handled?
Having a hard time finding what would cause this as there's currently no code specifically for handling dashes.
it is a known case that needs to be handled as the searcher strips out hyphens
see here https://our.umbraco.com/forum/using-umbraco-and-getting-started/101385-hyphens-in-lucene-search-examine
is working on a reply...