Case insensitive search

Vote:
 
var client = SearchClient.Instance.Search();

var search = client
    .For(query)
    .WithAndAsDefaultOperator()
    .InField(x => x.SearchTitle())
    .AndInField(x => x.SearchText())
    .Select(s => new SearchItem
    {
        Id = s.ContentLink.ID,
        Title = s.SearchTitle(),
        Excerpt = HighLight(s.SearchText(), query),
        Url = s.ContentLink.GetUrl(language),
        Type = s.PageTypeName
    });

This is our current search. I want to make the search case insensitive, but I can't find any documentation on how I could do that.

Closest I found was that I could do .Filter(x => x.Title.MatchCaseInsensitive("Find")), but this is a filter and not "inField" as we do it.

#118213
Mar 02, 2015 15:30
Vote:
 

We are running Find with simular query and it's not case sensitive.

I even checked unified search and it doesn't seem to be case sensitive either. Do you still have problems with this?

#119215
Mar 24, 2015 15:06
Vote:
 

Hi,

The .For(query)-statement is always case insensitive (and token delimited, i.e matches any token delimited by a breaking character (space, . , () just about any non letter or number). For example using .For("dog") will match "The dog ran outside".
As for .Filter() they by default don't do any delimitation and only 'matches' complete strings. For example the only match for Filter(x => x.Title.Match("dog")) is "dog" (and not "Dog" or any string containing "dog" as in the example before). There are as you have found extensions to the Filter-match that can do for example case insensitive matches but all of these are just 'wider' matches of the core Filter-match.

To sum it up think of .For() as a free text query in SQL and Filter() as the other Where clauses.

/Henrik

#119622
Mar 31, 2015 17:17
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.