I'm having some issues with whitespace and umbraco.examine.
When I do a search for dog everything is fine
but when I do a search for nice dog nothing works. The term "nice dog" is in my index. I've tried using both the whitespaceanalyser och the standard one and made sure that the index and the searcher match.
Are you doing MultipleCharacterWildcard() extension method on your query search string? Also you will need to split out your search term according to space and add it to your query eg
Thanks for your reply. No I'm not using a wildcard. I think your code will work but I'm unsure how to implement it in my razor solution. Could you have a look?
var searchString = Request["searchstring"]; if (!String.IsNullOrEmpty(searchString)) { var searchProvider = ExamineManager.Instance.DefaultSearchProvider.Name; var searchResults = ExamineManager.Instance.SearchProviderCollection[searchProvider].Search(searchString, true);
foreach (var node in searchResults.Take(100)) { <li><span>@node.Fields["nodeName"]</span>
Examine - Search with whitespace no good
Hi!
I'm having some issues with whitespace and umbraco.examine.
When I do a search for dog everything is fine
but when I do a search for nice dog nothing works. The term "nice dog" is in my index. I've tried using both the whitespaceanalyser och the standard one and made sure that the index and the searcher match.
Any clues to why this is?
Using examine version which ships with 4.7
Thanks / Niklas
Niklas,
Are you doing MultipleCharacterWildcard() extension method on your query search string? Also you will need to split out your search term according to space and add it to your query eg
if(qsValue.Contains(" "))
{
string[] terms = qsValue.Split(' ');
foreach (var term in terms)
{
queryToBuild = queryToBuild.Or().Field(key, term);
}
}
Regards
Ismail
Hi Ismail
Thanks for your reply. No I'm not using a wildcard. I think your code will work but I'm unsure how to implement it in my razor solution. Could you have a look?
var searchString = Request["searchstring"];
if (!String.IsNullOrEmpty(searchString))
{
var searchProvider = ExamineManager.Instance.DefaultSearchProvider.Name;
var searchResults = ExamineManager.Instance.SearchProviderCollection[searchProvider].Search(searchString, true);
foreach (var node in searchResults.Take(100))
{
<li> <span>@node.Fields["nodeName"]</span>
}
}
searchString. MultipleCharacterWildcard() you will need using statement for it cant remember which one it is but one of
using Examine;
using Examine.LuceneEngine.SearchCriteria;
using Examine.Providers;
using Examine.SearchCriteria;
Regards
Ismail
is working on a reply...