Searching in lower-case
I have a two-step search problem. First I want to see if any matches with the exact search-phrase - and then in step 2 take the generic full-text search across a number of properties.
I have mapped the property as follows:
[Field(Name = "CompanyNameFull",Index = Index.UnTokenized)]
[Field]
public string CompanyName { get; private set; }
My problem is that my users usually search in lowercase - and the company name is usually in proper case. So, "ibm*" doesn't find "IBM International", but "IBM*" does - and "ital*" doesn't find "Italian Furniture" while "Ital*" does.
I've tried in vain to attach an analyzer in the attribute to force it to be lowercase when indexed - but this fails, as the analyzer is only attached if it is a tokenized property (as far as I can开发者_如何学Python tell). I've tried various querying alternatives to no avail either.
What am I missing?
I've found a solution using a custom tokenizer/analzyer. It isn't exactly ideal, but it should still work.
精彩评论