dynquery is array string right? The multiplecharacterwildcard is extension for string which will tag * into end of term. So you could replace your grouped or with a loop and for each term wilcard it. What I usually have is using gathering node data all my fields munged into one field and then i can search on that. Are you currently getting a code compile error or is it all running but no search results coming back? If no saerch results can you do criteria.ToString() and paste back the generated query.
i have change my code with a loop but If I use "MultipleCharacterWildcard()" on a string, Visual Studio show me the error "string does not contain a definition for MultipleCharacterWildcard". What's wrong?
var criteria = ExamineManager.Instance .SearchProviderCollection["ExternalSearcher"] .CreateSearchCriteria();
string[] dynquery = new string[] { query }; if (multipleGroupedOr) { dynquery = query.Split(multipleGroupedOrSeparator); }
examine search criteria with wildcards
Hi,
I try to create a search criteria with wildcards for an autocomplete search.
How can I use wildcard search if I make my own search criteria like this:
MultipleCharacterWildcard() on dynquery doesn't work.
Thanks for any help!
dynquery is array string right? The multiplecharacterwildcard is extension for string which will tag * into end of term. So you could replace your grouped or with a loop and for each term wilcard it. What I usually have is using gathering node data all my fields munged into one field and then i can search on that. Are you currently getting a code compile error or is it all running but no search results coming back? If no saerch results can you do criteria.ToString() and paste back the generated query.
Regards
Ismail
Hi Ismail,
i have change my code with a loop but If I use "MultipleCharacterWildcard()" on a string, Visual Studio show me the error "string does not contain a definition for MultipleCharacterWildcard". What's wrong?
var criteria = ExamineManager.Instance
.SearchProviderCollection["ExternalSearcher"]
.CreateSearchCriteria();
string[] dynquery = new string[] { query };
if (multipleGroupedOr)
{
dynquery = query.Split(multipleGroupedOrSeparator);
}
Examine.SearchCriteria.IBooleanOperation crawl = null;
foreach (var word in dynquery)
{
if (crawl == null)
{
crawl = criteria.GroupedOr(fieldnames, word.MultipleCharacterWildcard());
}
else
{
crawl = crawl.Or().GroupedOr(fieldnames, word);
}
}
crawl = crawl
.Not()
.Field("umbracoNaviHide", "1")
.Not()
.Field("nodeTypeAlias", "Image");
ISearchResults SearchResults = ExamineManager.Instance
.SearchProviderCollection["ExternalSearcher"]
.Search(crawl.Compile());
Regards
Dominik
Dominik,
You maybe missing a using statement is in one of these
Regards
Ismail
That's it.
are missed.
Thank you.
Hi Ismail,
the wildcard and the autocomplete works. But if I search for a longtail for example "search term" there is no result. This is my code:
Any idea? Thanks
Do criteria.ToString() to see the generated query that will give you more information as to what is going on.
Regards
Ismail
Hi Ismail,
thanks for your help. To see the generated query helps a lot.
Regards Dominik
is working on a reply...