コード例 #1
0
        public LuceneIndexSearch(string analyzer_str)
        {
            luceneIndexDirectory = null;
            writer = null;
            switch (analyzer_str)
            {
            case "Simple Analyzer":
                analyzer = new Lucene.Net.Analysis.SimpleAnalyzer();
                Console.WriteLine("Simple Analyzer");
                break;

            case "Standard Analyzer":
                analyzer = analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
                Console.WriteLine("Standard Analyzer");
                break;

            case "Snowball Analyzer":
                // SnowballAnalyzer's second var "name" is the language of stemmer
                analyzer = new Lucene.Net.Analysis.Snowball.SnowballAnalyzer(Lucene.Net.Util.Version.LUCENE_30, "English");
                Console.WriteLine("Snowball Analyzer");
                break;

            default:
                analyzer = new Lucene.Net.Analysis.SimpleAnalyzer();
                break;
            }

            parser       = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, TEXT_FN_PASS_TEXT, analyzer);
            mySimilarity = new NewSimilarity();
        }
コード例 #2
0
 public LuceneIndexSearch()
 {
     luceneIndexDirectory = null;
     writer = null;
     // SnowballAnalyzer's second var "name" is the language of stemmer
     analyzer = new Lucene.Net.Analysis.SimpleAnalyzer();
     //analyzer = new Lucene.Net.Analysis.Snowball.SnowballAnalyzer(Lucene.Net.Util.Version.LUCENE_30, "English");
     parser       = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, TEXT_FN_PASS_TEXT, analyzer);
     mySimilarity = new NewSimilarity();
 }