Lucene.Net search with star (*) wildcard as first character

Using the star (*) as the first character of a Lucene.Net search is not supported by default. It will return null results if it is not turned on. To turn on the support for leading wild card characters you must set the SetAllowLeadingWildcard property to true. Then you will be able to use wildcard search parameters as the leading character.

Analyzer analyzer = new StandardAnalyzer(LuceneUtil.Version.LUCENE_29);
QueryParser parser = new QueryParser(LuceneUtil.Version.LUCENE_29,
"field", analyzer);
parser.SetAllowLeadingWildcard(true);

I searched for things like, can’t use * as first character of Lucene.Net search, * not supported as first value of Lucene.Net search or wildcard character as first character in Lucene.Net search but none resulted in me finding the answer. It took some investigation to find the solution but ultimately did and I am writing this blog so perhaps others can find it faster in the future.