Пример #1
0
        /// <summary>
        /// 全文检索功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            ///检索文法: http://docs.mongodb.org/manual/reference/command/text/#text-search-languages
            ///检索关键字
            var TextSearchOption = new BsonDocument().Add(new BsonElement("search", txtKey.Text));

            ///语言
            if (cmbLanguage.SelectedIndex != 0)
            {
                TextSearchOption.Add(new BsonElement("language", cmbLanguage.Text));
            }
            ///返回数限制
            TextSearchOption.Add(new BsonElement("limit", (BsonValue)NUDLimit.Value));
            try
            {
                CommandResult SearchResult = MongoDBHelper.ExecuteMongoColCommand("text", SystemManager.GetCurrentCollection(), TextSearchOption);
                Result = SearchResult.Response;
                MongoDBHelper.FillDataToTreeView("Text Search Result", trvResult, Result);
                cmdSave.Enabled = true;
            }
            catch (Exception ex)
            {
                SystemManager.ExceptionDeal(ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Run Validate
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdValidate_Click(object sender, EventArgs e)
        {
            var           TextSearchOption = new BsonDocument().Add(new BsonElement("full", chkFull.Checked.ToString()));
            CommandResult SearchResult     = MongoDBHelper.ExecuteMongoColCommand("validate", SystemManager.GetCurrentCollection(), TextSearchOption);

            Result = SearchResult.Response;
            MongoDBHelper.FillDataToTreeView("Validate Result", trvResult, Result);
            cmdSave.Enabled = true;
        }