Write your own analyzer class similar to SynonymAnalyzer in Lucene.Net - Custom Synonyms Analyzer . Your redefinition of TokenStream can solve this by pipelining the stream using the WhitespaceTokenizer and LowerCaseFilter .
Remember that your indexer and crawler must use the same parser.
Update: handling multiple comma-separated keywords
If you need to handle non-common comma-separated keywords for your search, rather than indexing, you can convert the search expression to expr , as shown below.
expr = expr.Replace(',', ' ');
Then go expr to QueryParser . If you want to support other delimiters like ';' you can do it like this:
var terms = expr.Split(new char[] { ',', ';'} ); expr = String.Join(" ", terms);
But you also need to check the expression of a phrase like "sybase, C #. Net, oracle" (the expression includes the quote "chars"), which should not be converted (the user is looking for an exact match):
expr = expr.Trim(); if (!(expr.StartsWith("\"") && expr.EndsWith("\""))) { expr = expr.Replace(',', ' '); }
An expression can include both a phrase and some keywords, for example:
"sybase,c#,.net,oracle" server,c
Then you need to parse and translate the search expression into this:
"sybase,c#,.net,oracle" server c
If you also need to process comma-delimited keywords with comma-delimited keywords for indexing, you need to analyze the text for the comma-classified keywords and save them in a separate field, for example. Keywords (which should be associated with your custom analyzer). Then your search handler should convert the search expression as follows:
server,c
:
Keywords:server Keywords:c# Keywords:.net, Keywords:sybase
or more simply:
Keywords:(server, c#, .net, sybase)