I am using Standard analyzer from lucene in my search engine to search for german words this is my code:
private IList<Document> GetFromLucene(string terme, string FieldName)
{
TopDocs hits;
CustomAnalyzer standardAnalyzer = new CustomAnalyzer(Lucene.Net.Util.Version.LUCENE_29);
List<Document> matches = new List<Document>();
IndexSearcher indexSearcher = new IndexSearcher(FSDirectory.Open(new System.IO.DirectoryInfo(MainDoc + DocIndex)), true);
if (terme.Contains(" "))
{
BooleanQuery finalQuery = new BooleanQuery();
string[] terms = terme.Split(' ');
#region AND
QueryParser queryParser = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, FieldName, standardAnalyzer)
{
DefaultOperator = QueryParser.Operator.AND
};
#endregion
#region Contains
Query querys = queryParser.Parse("" + terme + "*");
finalQuery.Add(querys, Occur.MUST);
#endregion
hits = indexSearcher.Search(finalQuery, int.MaxValue);
}
else
{
WildcardQuery query;
query = new WildcardQuery(new Term(FieldName, "*" + terme + "*"));
hits = indexSearcher.Search(query, int.MaxValue);
}
matches = hits.ScoreDocs.Select(scoreDoc => indexSearcher.Doc(scoreDoc.Doc)).ToList();
return matches;
}
it doesn't appear to find words containing "ü" and "ä". How can i achieve this ?