GetAnalyzerName() public static method

public static GetAnalyzerName ( string analyzerName ) : string
analyzerName string
return string
Beispiel #1
0
        private void btnUpdateParsedQuery_Click(object sender, System.EventArgs e)
        {
            string analyzerName = Analyzing.GetAnalyzerName((string)comboAnalyzer.SelectedItem);

            comboAnalyzer.SelectedItem = analyzerName;
            QueryParser qp     = CreateQueryParser(analyzerName);
            String      queryS = textSearch.Text;

            if (queryS.Trim() == "")
            {
                textParsed.Enabled = false;
                textParsed.Text    = _luke.resources.GetString("EmptyQuery");
                return;
            }
            textParsed.Enabled = true;

            try
            {
                Query q = qp.Parse(queryS);
                textParsed.Text = q.ToString();
            }
            catch (Exception exc)
            {
                textParsed.Text = exc.Message;
            }
        }
Beispiel #2
0
        internal void Search()
        {
            if (_luke.IndexReader == null)
            {
                _luke.ShowStatus(_luke.resources.GetString("NoIndex"));
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            string analyzerName = Analyzing.GetAnalyzerName((string)comboAnalyzer.SelectedItem);

            comboAnalyzer.SelectedItem = analyzerName;
            queryParser = CreateQueryParser(analyzerName);

            string queryString = textSearch.Text;

            if (queryString == string.Empty)
            {
                _luke.ShowStatus(_luke.resources.GetString("EmptyQuery"));
                return;
            }

            IndexSearcher searcher = null;

            listSearch.BeginUpdate();
            listSearch.Items.Clear();

            listSearch.EndUpdate();
            try
            {
                Query q = queryParser.Parse(queryString);

                if (searcher != null)
                {
                    searcher.Close();
                }
                searcher = new IndexSearcher(_luke.Directory, true);

                textParsed.Text = q.ToString();
                _Search(q, searcher);
            }
            catch (Exception e)
            {
                _luke.ErrorMessage(e.Message);
            }
            finally
            {
                if (searcher != null)
                {
                    try { searcher.Close(); }
                    catch (Exception) { }
                }
                ;
            }

            Cursor.Current = Cursors.Default;
        }