private static void Index() { IndexHelper indexHelper = new IndexHelper(Config.IndexFolder, Config.TextFilesFolder); indexHelper.CreateIndex(new PanGuAnalyzer()); Console.WriteLine("索引完成!"); }
public object Any(Ask request) { AskResponse response = new AskResponse(); response.Result = ErrorCode.OK; Guid creatorId = UserSession.GetUserId(); DateTime dateTime = DateTime.UtcNow; QuestionEntry questionEntry = new QuestionEntry(creatorId, Guid.NewGuid()) { Title = request.Title, Detail = request.Detail, Creation = dateTime, Modification = dateTime, Tags = string.Join(",", request.Tags).ToLowerInvariant() }; TableRepository tableRepository = new TableRepository(); tableRepository.InsertOrReplace(questionEntry, Tables.Questions); IndexHelper.CreateIndex(questionEntry.GetId(), request.Title + " " + questionEntry.Tags, Tables.Questions); return(response); }
private void _bgWorker_DoWork(object sender, DoWorkEventArgs e) { _indexHelper.CreateIndex(); }