The class allows searching of different kinds in the specified index and database
Inheritance: BaseSearcher
Esempio n. 1
0
        private void DoSearch(bool explain)
        {
            var search = new SitecoreSearcher(SessionManager.Instance.CurrentIndex);
            var infos  = new QueryInfo[]
            {
                new QueryInfo()
                {
                    FieldName      = txtFieldName1.Text,
                    SearchString   = txtSearchWord1.Text,
                    QueryType      = SitecoreQueryType1.Dropdown.SelectedValue,
                    QueryOccurance = QueryOccurance1.Dropdown.SelectedValue
                },
                new QueryInfo()
                {
                    FieldName      = txtFieldName2.Text,
                    SearchString   = txtSearchWord2.Text,
                    QueryType      = SitecoreQueryType2.Dropdown.SelectedValue,
                    QueryOccurance = QueryOccurance2.Dropdown.SelectedValue
                },
                new QueryInfo()
                {
                    FieldName      = txtFieldName3.Text,
                    SearchString   = txtSearchWord3.Text,
                    QueryType      = SitecoreQueryType3.Dropdown.SelectedValue,
                    QueryOccurance = QueryOccurance3.Dropdown.SelectedValue
                }
            };

            if (explain)
            {
                search.Explain = SearchResultGrid.SelectedIndex;
            }

            SessionManager.Instance.SitecoreSearchResult = search.FieldSearch(infos, 200);

            txtExplanation.Text = explain ? search.Explanation.ToString() : string.Empty;
        }
        private void DoSearch(bool explain)
        {
            var search = new SitecoreSearcher(SessionManager.Instance.CurrentIndex);
            var infos = new QueryInfo[]
                {
                    new QueryInfo()
                    {
                        FieldName = txtFieldName1.Text,
                        SearchString = txtSearchWord1.Text,
                        QueryType = SitecoreQueryType1.Dropdown.SelectedValue,
                        QueryOccurance = QueryOccurance1.Dropdown.SelectedValue
                    },
                    new QueryInfo()
                    {
                        FieldName = txtFieldName2.Text,
                        SearchString = txtSearchWord2.Text,
                        QueryType = SitecoreQueryType2.Dropdown.SelectedValue,
                        QueryOccurance = QueryOccurance2.Dropdown.SelectedValue
                    },
                    new QueryInfo()
                    {
                        FieldName = txtFieldName3.Text,
                        SearchString = txtSearchWord3.Text,
                        QueryType = SitecoreQueryType3.Dropdown.SelectedValue,
                        QueryOccurance = QueryOccurance3.Dropdown.SelectedValue
                    }
                };

            if (explain)
                search.Explain = SearchResultGrid.SelectedIndex;

            SessionManager.Instance.SitecoreSearchResult = search.FieldSearch(infos, 200);

            txtExplanation.Text = explain ? search.Explanation.ToString() : string.Empty;
        }