• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Standard.StandardAnalyzer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Lucene.Net.Analysis.Standard.StandardAnalyzer的典型用法代码示例。如果您正苦于以下问题:C# StandardAnalyzer类的具体用法?C# StandardAnalyzer怎么用?C# StandardAnalyzer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StandardAnalyzer类属于Lucene.Net.Analysis.Standard命名空间,在下文中一共展示了StandardAnalyzer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BuildQuery

		public static Query BuildQuery(string query)
		{
			var untokenizedMatches = untokenizedQuery.Matches(query);
			var rangeMatches = rangeQuery.Matches(query);
		    var standardAnalyzer = new StandardAnalyzer(Version.LUCENE_29);
		    try
		    {
                if (untokenizedMatches.Count == 0 && rangeMatches.Count == 0)
                    return new QueryParser(Version.LUCENE_29, "", standardAnalyzer).Parse(query);
                var sb = new StringBuilder(query);
                var booleanQuery = new BooleanQuery();
                AddUntokenizedTerms(untokenizedMatches, booleanQuery, sb, query);
		    	AddRangeTerms(rangeMatches, booleanQuery, sb, query);
                var remaining = sb.ToString();
		    	remaining = hangingConditionAtStart.Replace(remaining, "");
		    	remaining = hangingConditionAtEnd.Replace(remaining, "");
				remaining = remaining.Trim();
		    	if (remaining.Length > 0)
                {
                    booleanQuery.Add(new QueryParser(Version.LUCENE_29, "", standardAnalyzer).Parse(remaining), BooleanClause.Occur.SHOULD);
                }
                return booleanQuery;
		    }
		    finally
		    {
		        standardAnalyzer.Close();
		    }
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:28,代码来源:QueryBuilder.cs


示例2: _search

        private static IEnumerable<CustomerId> _search(string searchQuery)
        {
            // validation
            if (string.IsNullOrEmpty(searchQuery.Replace("*", "").Replace("?", ""))) return new List<CustomerId>();

            // set up lucene searcher
            using (var searcher = new IndexSearcher(_directory, false))
            {
                var hits_limit = 1000;
                var analyzer = new StandardAnalyzer(Version.LUCENE_29);

                {
                    //var query = new TermQuery(new Term("CustomerName", searchQuery));
                    var query = new BooleanQuery();
                    query.Add(new TermQuery(new Term("CustomerName", searchQuery)), Occur.MUST);
                    var hits = searcher.Search(query, hits_limit).ScoreDocs;
                    var results = _mapLuceneToDataList(hits, searcher);

                    analyzer.Close();
                    searcher.Dispose();
                    return results;
                }
                
            }
        }
开发者ID:jcwrequests,项目名称:Learning.Lucene.NET,代码行数:25,代码来源:CustomerIndexService.cs


示例3: CreateIndex

        public static void CreateIndex() {
            try
            {
                var cloudAccount = Azure.GetStorageAccount();

                using (var cacheDirectory = new RAMDirectory())
                {
                    using (var azureDirectory = new AzureDirectory(cloudAccount, Azure.StorageContainerName, cacheDirectory))
                    {
                        using (Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30))
                        {
                            using (var indexWriter = new IndexWriter(azureDirectory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED))
                            {
                                AddDocuments(indexWriter);

                                indexWriter.Commit();
                            }
                        }
                    }
                }
            }
            catch (StorageException ex)
            {
                Trace.TraceError(ex.Message);
            }
        }
开发者ID:nickmeldrum,项目名称:nickmeldrum.com.markdownblog,代码行数:26,代码来源:LuceneSearchConfig.cs


示例4: searchLucene

        public Data searchLucene(Data data)
        {
            Account_lg account = new Account_lg();
            List<string> item = new List<string>();
            Lucene.Net.Store.Directory directory = FSDirectory.Open(new DirectoryInfo("C:\\Visual Studio 2010\\Transaction" + "\\LuceneIndex"));
            var analyzer = new StandardAnalyzer(Version.LUCENE_29);
            IndexReader reader = IndexReader.Open(directory, true);
            IndexSearcher searcher = new IndexSearcher(reader);

            MultiFieldQueryParser parser = new MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_29, new string[] { "name", "username" }, analyzer);  //search for multifield
            Query query = parser.Parse((data.getString("search")) + "*"); //cant search blank text with wildcard as first character

            TopScoreDocCollector collector = TopScoreDocCollector.Create(1000, true);
            searcher.Search(query, collector);
            ScoreDoc[] hits = collector.TopDocs().ScoreDocs;
            int count = hits.Length;

            for (int i = 0; i < count; i++)
            {
                int docId = hits[i].Doc;
                float score = hits[i].Score;

                Document doc = searcher.Doc(docId);

                string id = doc.Get("id");
                item.Add(id);
            }
            Data list = account.selectUser(data, item.ToArray());
            reader.Dispose();
            searcher.Dispose();

            return list;
        }
开发者ID:hyori7,项目名称:AccountTransaction,代码行数:33,代码来源:Lucene_lg.cs


示例5: PerformExplain

        /// <summary>
        /// Performs the explanation.
        /// </summary>
        /// <param name="luceneVersion">The lucene version.</param>
        /// <param name="fsDirectory">The fs directory.</param>
        /// <param name="searchQuery">The search query.</param>
        /// <param name="resultId">The result identifier.</param>
        /// <returns></returns>
        protected virtual string PerformExplain(Version luceneVersion, FSDirectory fsDirectory, string searchQuery, int resultId)
		{
			/*
			 * The obvious problem here is that we're not using the exact same search as the real one.
			 */

			var explanation = string.Empty;

			using (var indexSearcher = new IndexSearcher(fsDirectory, false))
			{
				var analyzer = new StandardAnalyzer(luceneVersion);
				
				var queryParser = new MultiFieldQueryParser(luceneVersion, new[] { "Id".ToLowerInvariant() }, analyzer)
									{
										DefaultOperator = QueryParser.Operator.AND
									};
				
				var query = this.searchQueryParser.ParseQuery(searchQuery, queryParser);

				explanation = indexSearcher.Explain(query, resultId).ToHtml();

				analyzer.Close();
			}

			return explanation;
		}
开发者ID:KaraokeStu,项目名称:LeadPipe.Net,代码行数:34,代码来源:SearchScoreExplainer.cs


示例6: ParseQuery

        private static Query ParseQuery(string searchTerm)
        {
            var fields = new Dictionary<string, float> { { "Id", 1.2f }, { "Title", 1.0f }, { "Tags", 1.0f}, { "Description", 0.8f }, { "Author", 0.6f } };
            var analyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion);
            searchTerm = QueryParser.Escape(searchTerm).ToLowerInvariant();

            var queryParser = new MultiFieldQueryParser(LuceneCommon.LuceneVersion, fields.Keys.ToArray(), analyzer, fields);

            var conjuctionQuery = new BooleanQuery();
            conjuctionQuery.SetBoost(1.5f);
            var disjunctionQuery = new BooleanQuery();
            var wildCardQuery = new BooleanQuery();
            wildCardQuery.SetBoost(0.7f);
            var exactIdQuery = new TermQuery(new Term("Id-Exact", searchTerm));
            exactIdQuery.SetBoost(2.5f);

            foreach(var term in searchTerm.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
            {
                conjuctionQuery.Add(queryParser.Parse(term), BooleanClause.Occur.MUST);
                disjunctionQuery.Add(queryParser.Parse(term), BooleanClause.Occur.SHOULD);

                foreach (var field in fields)
                {
                    var wildCardTermQuery = new WildcardQuery(new Term(field.Key, term + "*"));
                    wildCardTermQuery.SetBoost(0.7f * field.Value);
                    wildCardQuery.Add(wildCardTermQuery, BooleanClause.Occur.SHOULD);
                }
            }

            return conjuctionQuery.Combine(new Query[] { exactIdQuery, conjuctionQuery, disjunctionQuery, wildCardQuery });
        }
开发者ID:N198,项目名称:NugetGallery21-DeleteMe,代码行数:31,代码来源:LuceneSearchService.cs


示例7: CreateIndex

        public void CreateIndex(List<ISearchEntity> CreateEntities)
        {
            Analyzer analyzer = new StandardAnalyzer();
            IndexWriter writer = new IndexWriter(ConfigElement.IndexDirectory, analyzer, true);
            //第三个参数:是否重新创建索引,True 一律清空 重新建立 False 原有基础上增量添加索引

            foreach (ISearchEntity IndexEntity in CreateEntities)
            {
                NewsModel news = (NewsModel)IndexEntity;

                Document doc = new Document();

                doc.Add(new Field("newsid", Convert.ToString(news.EntityIdentity), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("title", Convert.ToString(news.Title), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("content", Convert.ToString(news.Content), Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("keywords", Convert.ToString(news.Keywords), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("catepath", Convert.ToString(news.CategoryPath), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("createtime", Convert.ToString(news.CreateTime), Field.Store.YES, Field.Index.UN_TOKENIZED));

                writer.AddDocument(doc);
                Console.WriteLine("created index for {0}:{1}", news.EntityIdentity, news.Title);
            }

            writer.Optimize();
            writer.Close();
        }
开发者ID:ViniciusConsultor,项目名称:noname-netshop,代码行数:26,代码来源:DataIndexerNews.cs


示例8: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            String field = "content";

            IndexReader reader = IndexReader.Open(FSDirectory.Open(new DirectoryInfo(INDEX_DIR.FullName)), true);

            Searcher searcher = new IndexSearcher(reader);
            Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);

            QueryParser parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, field, analyzer);

            Query query = parser.Parse(textBox1.Text.Trim());

            TopScoreDocCollector collector = TopScoreDocCollector.Create(searcher.MaxDoc, false);
            searcher.Search(query, collector);
            ScoreDoc[] hits = collector.TopDocs().ScoreDocs;

            MessageBox.Show(this, "共 " + collector.TotalHits.ToString() + " 条记录");

            //ltrResult.Text = "共 " + collector.GetTotalHits().ToString() + " 条记录<br>";

            //for (Int32 i = 0; i < collector.GetTotalHits(); i++)
            //{
            //    ltrResult.Text += "doc=" + hits[i].doc + " score=" + hits[i].score + "<br>";
            //    Document doc = searcher.Doc(hits[i].doc);
            //    ltrResult.Text += "Path:" + doc.Get("path") + "<br>";
            //}

            reader.Dispose();

        }
开发者ID:changweihua,项目名称:VS2012.FormSolution,代码行数:31,代码来源:Form1.cs


示例9: LuceneHighlightHelper

		private LuceneHighlightHelper()
		{
			Separator = "...";
			MaxNumHighlights = 5;
			HighlightAnalyzer = new StandardAnalyzer(_luceneVersion);
			HighlightFormatter = new SimpleHTMLFormatter("", " ");
		}
开发者ID:joosthollander,项目名称:Macaw.Umbraco.Foundation,代码行数:7,代码来源:LuceneHighlightHelper.cs


示例10: GetSearchResult

        public override List<ISearchEntity> GetSearchResult(out int MatchCount)
        {
            Analyzer analyzer = new StandardAnalyzer();

            IndexSearcher searcher = new IndexSearcher(searchInfo.ConfigElement.IndexDirectory);
            MultiFieldQueryParser parserName = new MultiFieldQueryParser(new string[] { "title", "content", "keywords" }, analyzer);

            Query queryName = parserName.Parse(searchInfo.QueryString);

            Hits hits = searcher.Search(queryName);

            List<ISearchEntity> ResultList = new List<ISearchEntity>();

            for (int i = 0; i < hits.Length(); i++)
            {
                Document doc = hits.Doc(i);

                ResultList.Add((ISearchEntity)new NewsModel()
                {
                    EntityIdentity = Convert.ToInt32(doc.Get("newsid")),
                    Title = Convert.ToString(doc.Get("title")),
                    Content = Convert.ToString(doc.Get("content")),
                    Keywords = doc.Get("keywords")
                });
            }
            searcher.Close();

            MatchCount = hits.Length();
            return ResultList;
        }
开发者ID:ViniciusConsultor,项目名称:noname-netshop,代码行数:30,代码来源:NewsSearcher.cs


示例11: Engine

        public Engine()
        {
            var directory = new RAMDirectory();
            var analyzer = new StandardAnalyzer(Version.LUCENE_30);

            using (var indexWriter = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED))
            {
                for (int i = 0; i < 10000; i++)
                {
                    Console.Write(".");
                    var document = new Document();
                    document.Add(new Field("Id", i.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
                    document.Add(new Field("Name", "Name" + i.ToString(), Field.Store.YES, Field.Index.ANALYZED));
                    indexWriter.AddDocument(document);
                }
            }

            Console.ReadKey();

            var queryParser = new QueryParser(Version.LUCENE_30, "Name", analyzer);
            var query = queryParser.Parse("Name37~");

            IndexReader indexReader = IndexReader.Open(directory, true);
            var searcher = new IndexSearcher(indexReader);

            TopDocs resultDocs = searcher.Search(query, indexReader.MaxDoc);
        }
开发者ID:trulstveoy,项目名称:Sandbox,代码行数:27,代码来源:Engine.cs


示例12: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            Directory index = new RAMDirectory();
            StandardAnalyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);

            IndexWriter w = new IndexWriter(index, analyzer);

            addDoc(w, "Lucene in Action");
            addDoc(w, "Lucene for Dummies");
            addDoc(w, "Managing Gigabytes");
            addDoc(w, "The Art of Computer Science");
            w.Close();

            String querystr = "Lucene in Action";

            Query q =  new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "title", analyzer).Parse(querystr);
            //q.Parse();

            int hitsPerPage = 10;
            IndexReader reader = IndexReader.Open(index,true);
            IndexSearcher searcher = new IndexSearcher(reader);
            TopScoreDocCollector collector = TopScoreDocCollector.Create(hitsPerPage, true);
            searcher.Search(q, collector);
            ScoreDoc[] hits = collector.TopDocs().ScoreDocs;

            System.Console.WriteLine("Found {0} Hits", hits.Length);

            foreach (var item in hits)
            {
                int docId = item.Doc;
                Document d = searcher.Doc(docId);
                System.Console.WriteLine(d.Get("title") + " " + item.Score);
            }
        }
开发者ID:samfisher83,项目名称:lucene,代码行数:34,代码来源:Form1.cs


示例13: HelloWorldTest

        public void HelloWorldTest()
        {
            Directory directory = new RAMDirectory();
            Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);
            IndexWriter writer = new IndexWriter(directory,
                analyzer,
                IndexWriter.MaxFieldLength.UNLIMITED);

            Document doc = new Document();
            doc.Add(new Field("id", "1", Field.Store.YES, Field.Index.NO));
            doc.Add(new Field("postBody", "sample test", Field.Store.YES, Field.Index.ANALYZED));
            writer.AddDocument(doc);
            writer.Optimize();
            writer.Commit();
            writer.Close();

            QueryParser parser = new QueryParser(Version.LUCENE_29, "postBody", analyzer);
            Query query = parser.Parse("sample test");

            //Setup searcher
            IndexSearcher searcher = new IndexSearcher(directory, true);
            //Do the search
            var hits = searcher.Search(query, null, 10);

            for (int i = 0; i < hits.TotalHits; i++)
            {
                var doc1 = hits.ScoreDocs[i];
            }

            searcher.Close();
            directory.Close();
        }
开发者ID:oleksii-mdr,项目名称:nTextNetwork,代码行数:32,代码来源:HelloWorldLuceneTest.cs


示例14: GetAllMoviesWith

        public void GetAllMoviesWith(string textSearch, int maxCount, out List<string> movies, out List<string> reviews, IList<string> filters = null)
        {
            reviews = new List<string>();
            movies = new List<string>();

            try
            {
                var analyzer = new StandardAnalyzer(Version.LUCENE_30);
                var query = ParseQuery(textSearch, filters, analyzer);
                var hits = _searcher.Search(query, 10);

                if (hits == null)
                {
                    Trace.TraceWarning("Search query {0} didn't generate any results", textSearch);
                    return;
                }
                else
                {
                    Trace.TraceInformation("Results for search query {0} : hits {1} max score {2} score docs {3}", textSearch, hits.TotalHits, hits.MaxScore, hits.ScoreDocs);
                    foreach (var doc in hits.ScoreDocs)
                    {
                        GetIdsFromSearchQueries(_searcher.Doc(doc.Doc), movies, reviews);
                    }
                }
            }
            catch (Exception err)
            {
                Trace.TraceError("Get all movies failed with exception {0}", err);
                throw;
            }
        }
开发者ID:viren85,项目名称:moviemirchi,代码行数:31,代码来源:IndexQuery.cs


示例15: Search

        IEnumerable<string> Search(string textToFind)
        {
            var reader = IndexReader.Open(_ramDirectory, true);
            var searcher = new IndexSearcher(reader);
            var analyzer = new StandardAnalyzer(Version.LUCENE_29);
            var parser = new MultiFieldQueryParser(Version.LUCENE_29, _searchFields, analyzer);

            var query = parser.Parse(textToFind);

            var collector = TopScoreDocCollector.create(100, true);

            searcher.Search(query, collector);

            var hits = collector.TopDocs().scoreDocs;
            var foundKeys = new List<string>();
            foreach (ScoreDoc scoreDoc in hits)
            {

                var document = searcher.Doc(scoreDoc.doc);
                var key = document.Get(_keyField);

                if (key != null && !foundKeys.Contains(key))
                {
                    foundKeys.Add(key);
                }
            }
            reader.Close();
            searcher.Close();
            analyzer.Close();
            return foundKeys;
        }
开发者ID:MikeLarah,项目名称:YouTrackSharp,代码行数:31,代码来源:LuceneIssuePatternMatching.cs


示例16: Main

    static void Main(string[] args)
    {
        // Path to index file.
            Directory pdfIndex = FSDirectory.Open(@"/* PASTE THE PATH WHERE YOUR INDEX WILL BE SAVED */");

            // Creating analyzer to make index searchable.
            Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);

            // Creating IndexWriter
            IndexWriter.MaxFieldLength mfl = new IndexWriter.MaxFieldLength(100000);
            IndexWriter writer = new IndexWriter(pdfIndex, analyzer, mfl);

            // Full path to input .pdf files.
            string[] filesList = System.IO.Directory.GetFiles(@"/* PASTE THE PATH TO YOUR INPUT FILE(S) */", "*.pdf");

            /* INDEX FIELDS:
            ** id & body are the fields to my Lucene Index,
            ** you can change those fields accordingly to your
            ** needs
            */
            int idNumber = 0;
            string pdfText;

            foreach (string file in filesList)
            {
                pdfText = GetAllText(file);
                AddToIndex(idNumber, pdfText, writer);
                idNumber++;
            }
            writer.Dispose();
            DisplayAllInput(filesList);
            Console.ReadKey();
    }
开发者ID:PanosVl,项目名称:data-indexing-and-searching,代码行数:33,代码来源:pdfIndexing.cs


示例17: _search

		// main search method
		private static IEnumerable<SampleData> _search(string searchQuery, string searchField = "") {
			// validation
			if (string.IsNullOrEmpty(searchQuery.Replace("*", "").Replace("?", ""))) return new List<SampleData>();

			// set up lucene searcher
			using (var searcher = new IndexSearcher(_directory, false)) {
				var hits_limit = 1000;
				var analyzer = new StandardAnalyzer(Version.LUCENE_29);

				// search by single field
				if (!string.IsNullOrEmpty(searchField)) {
					var parser = new QueryParser(Version.LUCENE_29, searchField, analyzer);
					var query = parseQuery(searchQuery, parser);
					var hits = searcher.Search(query, hits_limit).ScoreDocs;
					var results = _mapLuceneToDataList(hits, searcher);
					analyzer.Close();
					searcher.Close();
					searcher.Dispose();
					return results;
				}
				// search by multiple fields (ordered by RELEVANCE)
				else {
					var parser = new MultiFieldQueryParser
						(Version.LUCENE_29, new[] {"Id", "Name", "Description"}, analyzer);
					var query = parseQuery(searchQuery, parser);
					var hits = searcher.Search(query, null, hits_limit, Sort.INDEXORDER).ScoreDocs;
					var results = _mapLuceneToDataList(hits, searcher);
					analyzer.Close();
					searcher.Close();
					searcher.Dispose();
					return results;
				}
			}
		}
开发者ID:CelticHarp,项目名称:Lucene.Net-search-MVC-sample-site,代码行数:35,代码来源:LuceneSearch.cs


示例18: CreateIndex

        public void CreateIndex(List<ISearchEntity> CreateEntities)
        {
            Analyzer analyzer = new StandardAnalyzer();
            IndexWriter writer = new IndexWriter(ConfigElement.IndexDirectory, analyzer, true);
            //第三个参数:是否重新创建索引,True 一律清空 重新建立 False 原有基础上增量添加索引

            foreach (ISearchEntity IndexEntity in CreateEntities)
            {
                ProductModel product = (ProductModel)IndexEntity;

                Document doc = new Document();

                doc.Add(new Field("productid", Convert.ToString(product.EntityIdentity), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("productname", Convert.ToString(product.ProductName), Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("cateid", Convert.ToString(product.CategoryID), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("catepath", Convert.ToString(product.CategoryPath), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("keywords", Convert.ToString(product.Keywords), Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("description", Convert.ToString(product.Description), Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("price", Convert.ToString(product.Price), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("createtime", Convert.ToString(product.CreateTime), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("updatetime", Convert.ToString(product.UpdateTime), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("mainimage", Convert.ToString(product.ProductImage), Field.Store.YES, Field.Index.UN_TOKENIZED));

                writer.AddDocument(doc);
                Console.WriteLine("created index for {0}:{1}", product.EntityIdentity, product.ProductName);
            }

            writer.Optimize();
            writer.Close();
        }
开发者ID:ViniciusConsultor,项目名称:noname-netshop,代码行数:30,代码来源:DataIndexerProduct.cs


示例19: LuceneWriter

 public LuceneWriter(string folder)
 {
     _folder = folder;
     _indexDirectory = FSDirectory.Open(new DirectoryInfo(folder));
     _standardAnalyzer = new StandardAnalyzer(Version.LUCENE_30);
     _indexWriter = new IndexWriter(_indexDirectory, _standardAnalyzer, IndexWriter.MaxFieldLength.UNLIMITED);
 }
开发者ID:modulexcite,项目名称:SQLoogle,代码行数:7,代码来源:LuceneWriter.cs


示例20: Init

        /// <summary>
        /// Inits this instance.
        /// </summary>
        public void Init()
        {
            server = new HttpServer();
            Url = server.Url;
            var indexDir = Content.Index;
            indexReader = IndexReader.Open(indexDir, true);
            indexSearcher = new IndexSearcher(indexReader);
            analyzer = new StandardAnalyzer(Version.LUCENE_29);

            server.ProcessRequest += ServerProcessRequest;
            server.Start();

            var labels = new StringBuilder();

            // Sort tags by alphabetical order
            Content.Tags.Sort((from, to) => from.Name.CompareTo(to.Name));

            foreach (var tagIndex in Content.Tags)
            {
                labels.AppendFormat(
                    @"<label style='float: left; margin-right: 8px'><input type='checkbox' name='{0}' checked='true'/>{1}</label>",
                    tagIndex.Id, tagIndex.Name).AppendLine();
            }
            searchOptions = labels.ToString();
        }
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:28,代码来源:DocumentServer.cs



注:本文中的Lucene.Net.Analysis.Standard.StandardAnalyzer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Standard.StandardTokenizer类代码示例发布时间:2022-05-26
下一篇:
C# Analysis.TokenStream类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap