Exemplo n.º 1
0
        private static void Index()
        {
            IndexHelper indexHelper = new IndexHelper(Config.IndexFolder, Config.TextFilesFolder);

            indexHelper.CreateIndex(new PanGuAnalyzer());
            Console.WriteLine("索引完成!");
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 private void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     _indexHelper.CreateIndex();
 }