Beispiel #1
0
 private void InitializeState()
 {
     if (_State == null)
     {
         if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
         {
             _Context.RegisterConfigurationType(typeof(SpeedSearchState));
         }
         _State = _Context.GetConfiguration <SpeedSearchState>();
     }
     if ((_State != null) && (_State.SelectedIndexes.Count > 0))
     {
         SearchRequest.Text            = _State.SearchText;
         SearchType.SelectedIndex      = _State.SearchTypeIdx;
         MaxResults.SelectedValue      = _State.MaxResults.ToString();
         SearchFlags.Items[0].Selected = _State.Root;
         SearchFlags.Items[1].Selected = _State.Thesaurus;
         SearchFlags.Items[2].Selected = _State.SoundsLike;
         for (int idx = 0; idx < _Indexes.Count; idx++)
         {
             CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + idx.ToString());
             if (thisIndex != null)
             {
                 thisIndex.Checked = false;
                 if (_State.SelectedIndexes.Contains(idx))
                 {
                     thisIndex.Checked = true;
                 }
             }
         }
     }
 }
Beispiel #2
0
    public void DoSearch()
    {
        currentIndex.Value = "";
        _state             = new SpeedSearchState
        {
            SearchText    = SearchRequest.Text,
            SearchTypeIdx = SearchType.SelectedIndex,
            Root          = SearchFlags.Items[0].Selected,
            Thesaurus     = SearchFlags.Items[1].Selected,
            SoundsLike    = SearchFlags.Items[2].Selected,
            MaxResults    = int.Parse(MaxResults.SelectedValue)
        };
        var ss  = new SpeedSearchService();
        var ssq = BuildQuery();

        Session[ClientID + "_SearchQry"] = ssq.GetAsXml();
        string xml = ss.DoSpeedSearch(ssq).GetAsXml();

        Session[ClientID] = xml;

        InitResults(xml);
        if (!_context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
        {
            _context.RegisterConfigurationType(typeof(SpeedSearchState));
        }
        _context.WriteConfiguration(_state);
    }
Beispiel #3
0
 protected void SpeedSearchReset_Click(object sender, ImageClickEventArgs e)
 {
     _State = new SpeedSearchState();
     for (int i = 0; i < _Indexes.Count; i++)
     {
         _State.SelectedIndexes.Add(i);
     }
     if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
     {
         _Context.RegisterConfigurationType(typeof(SpeedSearchState));
     }
     _Context.WriteConfiguration(_State);
 }
Beispiel #4
0
    public void DoSearch()
    {
        currentIndex.Value   = "";
        _State               = new SpeedSearchState();
        _State.SearchText    = SearchRequest.Text;
        _State.SearchTypeIdx = SearchType.SelectedIndex;
        _State.Root          = SearchFlags.Items[0].Selected;
        _State.Thesaurus     = SearchFlags.Items[1].Selected;
        _State.SoundsLike    = SearchFlags.Items[2].Selected;
        _State.MaxResults    = int.Parse(MaxResults.SelectedValue);
        //SpeedSearchWebService.SpeedSearchService ss = new SpeedSearchWebService.SpeedSearchService();
        //ss.Url = ConfigurationManager.AppSettings.Get("SpeedSearchWebService.SpeedSearchService");
        SpeedSearchService ss  = new SpeedSearchService();
        SpeedSearchQuery   ssq = BuildQuery();

        if (Session[ClientID + "_SearchQry"] != null)
        {
            Session[ClientID + "_SearchQry"] = ssq.GetAsXml();
        }
        else
        {
            Session[ClientID + "_SearchQry"] = ssq.GetAsXml();
        }
        string xml = ss.DoSpeedSearch(ssq.GetAsXml());

        if (Session[ClientID] != null)
        {
            Session[ClientID] = xml;
        }
        else
        {
            Session[ClientID] = xml;
        }
        initResults(xml);
        if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
        {
            _Context.RegisterConfigurationType(typeof(SpeedSearchState));
        }
        _Context.WriteConfiguration(_State);
    }
    public void DoSearch()
    {
        currentIndex.Value = "";
        _State = new SpeedSearchState();
        _State.SearchText = SearchRequest.Text;
        _State.SearchTypeIdx = SearchType.SelectedIndex;
        _State.Root = SearchFlags.Items[0].Selected;
        _State.Thesaurus = SearchFlags.Items[1].Selected;
        _State.SoundsLike = SearchFlags.Items[2].Selected;
        _State.MaxResults = int.Parse(MaxResults.SelectedValue);
        SpeedSearchService ss = new SpeedSearchService();
        SpeedSearchQuery ssq = BuildQuery();

        Session[ClientID + "_SearchQry"] = ssq.GetAsXml();
        string xml = ss.DoSpeedSearch(ssq.GetAsXml());
        Session[ClientID] = xml;

        initResults(xml);
        if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
        {
            _Context.RegisterConfigurationType(typeof(SpeedSearchState));
        }
        _Context.WriteConfiguration(_State);
    }
 private void InitializeState()
 {
     if (_State == null)
     {
         if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
         {
             _Context.RegisterConfigurationType(typeof(SpeedSearchState));
         }
         _State = _Context.GetConfiguration<SpeedSearchState>();
     }
     if ((_State != null) && (_State.SelectedIndexes.Count > 0))
     {
         SearchRequest.Text = _State.SearchText;
         SearchType.SelectedIndex = _State.SearchTypeIdx;
         MaxResults.SelectedValue = _State.MaxResults.ToString();
         SearchFlags.Items[0].Selected = _State.Root;
         SearchFlags.Items[1].Selected = _State.Thesaurus;
         SearchFlags.Items[2].Selected = _State.SoundsLike;
         for (int idx = 0; idx < _Indexes.Count; idx++)
         {
             CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + idx.ToString());
             if (thisIndex != null)
             {
                 thisIndex.Checked = false;
                 if (_State.SelectedIndexes.Contains(idx))
                 {
                     thisIndex.Checked = true;
                 }
             }
         }
     }
 }
 protected void SpeedSearchReset_Click(object sender, ImageClickEventArgs e)
 {
     _State = new SpeedSearchState();
     for (int i = 0; i < _Indexes.Count; i++)
     {
         _State.SelectedIndexes.Add(i);
     }
     if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState)))
     {
         _Context.RegisterConfigurationType(typeof(SpeedSearchState));
     }
     _Context.WriteConfiguration(_State);
 }