Ejemplo n.º 1
0
    //protected void btnReturnResult_Click(object sender, EventArgs e)
    private void ReturnResult()
    {
        InitializeState();
        int index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);

        if (string.IsNullOrEmpty(currentIndex.Value))
        {
            return;
        }
        whichResultsPage = index;
        SpeedSearchService ss  = new SpeedSearchService();
        SpeedSearchQuery   ssq = BuildQuery();

        ssq.DocTextItem = int.Parse(currentIndex.Value) + 1000000;
        string xml = ss.DoSpeedSearch(ssq.GetAsXml());

        Results = SpeedSearchResults.LoadFromXml(xml);

        _ResultEntity = (EntityBase)m_EntityContextService.GetEntity();
        if (!string.IsNullOrEmpty(_ChildPropertyName))
        {
            PropertyDescriptor child = TypeDescriptor.GetProperties(_ResultEntity.GetType())[_ChildPropertyName];
            _ResultEntity = (EntityBase)child.GetValue(_ResultEntity);
        }
        PropertyDescriptor resultProp = TypeDescriptor.GetProperties(_ResultEntity.GetType())[_ResultProperty];

        resultProp.SetValue(_ResultEntity, Results.Items[0].HighlightedDoc);

        DialogService.CloseEventHappened(null, null);
    }
Ejemplo n.º 2
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);
        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);
    }
Ejemplo n.º 3
0
 protected override void OnPreRender(EventArgs e)
 {
     if (this.Visible)
     {
         InitializeState();
         if (!string.IsNullOrEmpty(MarkUsedInfo.Value))
         {
             SetItemAsUsed();
             MarkUsedInfo.Value = string.Empty;
         }
         if (!string.IsNullOrEmpty(ReturnResultAction.Value))
         {
             ReturnResult();
             ReturnResultAction.Value = string.Empty;
             WebPortalPage page = Page as WebPortalPage;
             if (page != null)
             {
                 IPanelRefreshService refresher = page.PageWorkItem.Services.Get <IPanelRefreshService>();
                 if (refresher != null)
                 {
                     refresher.RefreshAll();
                 }
             }
         }
         if (!string.IsNullOrEmpty(currentIndex.Value))
         {
             Literal document = new Literal();
             if (currentIndex.Value.Equals("NoAccess"))
             {
                 document.Text = GetLocalResourceObject("SpeedSearch_Result_NoAccess").ToString();
             }
             else
             {
                 int index = (string.IsNullOrEmpty(CurrentPageIndex.Value)) ? 0 : int.Parse(CurrentPageIndex.Value);
                 whichResultsPage = index;
                 //SpeedSearchWebService.SpeedSearchService ss = new SpeedSearchWebService.SpeedSearchService();
                 //ss.Url = ConfigurationManager.AppSettings.Get("SpeedSearchWebService.SpeedSearchService");
                 SpeedSearchService ss  = new SpeedSearchService();
                 SpeedSearchQuery   ssq = BuildQuery();
                 ssq.DocTextItem = int.Parse(currentIndex.Value);
                 string xml = ss.DoSpeedSearch(ssq.GetAsXml());
                 Results       = SpeedSearchResults.LoadFromXml(xml);
                 document.Text = Results.Items[0].HighlightedDoc;
             }
             currentIndex.Value   = "";
             FirstPage.Visible    = true;
             PreviousPage.Visible = true;
             NextPage.Visible     = true;
             LastPage.Visible     = true;
             //SearchDocumentPanel.ContentTemplateContainer.Controls.Add(document);
         }
     }
     base.OnPreRender(e);
 }
Ejemplo n.º 4
0
    private SpeedSearchQuery BuildQuery()
    {
        var ssq = new SpeedSearchQuery {
            SearchText = SearchRequest.Text
        };

        if (string.IsNullOrEmpty(ssq.SearchText))
        {
            throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Keyword_Required").ToString());
        }
        ssq.SearchType       = SearchType.SelectedIndex;
        ssq.IncludeStemming  = SearchFlags.Items[0].Selected;
        ssq.IncludeThesaurus = SearchFlags.Items[1].Selected;
        ssq.IncludePhonic    = SearchFlags.Items[2].Selected;
        ssq.WhichPage        = _whichResultsPage;
        ssq.ItemsPerPage     = 10;
        _state.SelectedIndexes.Clear();
        for (var i = 0; i < _indexes.Count; i++)
        {
            var thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + i);
            if ((thisIndex != null) && (thisIndex.Checked))
            {
                ssq.Indexes.Add(new SpeedSearchIndex(_indexes[i].IndexName, _indexes[i].Type.Value, _indexes[i].IsSecure ?? false));
                _state.SelectedIndexes.Add(i);
            }
        }
        if (ssq.Indexes.Count == 0)
        {
            throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Index_Required").ToString());
        }
        var freqfilter = (CheckBox)PlaceHolder2.FindControl("FreqUsed");

        if ((freqfilter != null) && (freqfilter.Checked))
        {
            ssq.UseFrequentFilter = true;
        }
        foreach (var fd in _searchFilters.Values)
        {
            var filter = (TextBox)PlaceHolder2.FindControl(fd.DisplayName);
            if ((filter != null) && (!string.IsNullOrEmpty(filter.Text)))
            {
                ssq.Filters.Add(new SpeedSearchFilter(fd.DisplayName, filter.Text, fd.CommonIndexes, fd.FieldType, fd.IndexType));
            }
        }
        return(ssq);
    }
Ejemplo n.º 5
0
    private SpeedSearchQuery BuildQuery()
    {
        SpeedSearchQuery ssq = new SpeedSearchQuery();

        ssq.SearchText       = SearchRequest.Text;
        ssq.SearchType       = SearchType.SelectedIndex;
        ssq.IncludeStemming  = SearchFlags.Items[0].Selected;
        ssq.IncludeThesaurus = SearchFlags.Items[1].Selected;
        ssq.IncludePhonic    = SearchFlags.Items[2].Selected;
        ssq.WhichPage        = whichResultsPage;
        ssq.ItemsPerPage     = 10;
        for (int i = 0; i < _Indexes.Count; i++)
        {
            CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + i.ToString());
            if ((thisIndex != null) && (thisIndex.Checked))
            {
                ssq.Indexes.Add(_Indexes[i].IndexName);
                _State.SelectedIndexes.Add(i);
            }
        }
        CheckBox freqfilter = (CheckBox)PlaceHolder2.FindControl("FreqUsed");

        if ((freqfilter != null) && (freqfilter.Checked))
        {
            ssq.UseFrequentFilter = true;
        }
        foreach (SlxFieldDefinition fd in _SearchFilters.Values)
        {
            TextBox filter = (TextBox)PlaceHolder2.FindControl(fd.DisplayName);
            if ((filter != null) && (!string.IsNullOrEmpty(filter.Text)))
            {
                ssq.Filters.Add(new SpeedSearchFilter(fd.DisplayName, filter.Text, fd.CommonIndexes, fd.FieldType, fd.IndexType));
            }
        }
        return(ssq);
    }
 private SpeedSearchQuery BuildQuery()
 {
     SpeedSearchQuery ssq = new SpeedSearchQuery();
     ssq.SearchText = SearchRequest.Text;
     if (string.IsNullOrEmpty(ssq.SearchText))
     {
         throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Keyword_Required").ToString());
     }
     ssq.SearchType = SearchType.SelectedIndex;
     ssq.IncludeStemming = SearchFlags.Items[0].Selected;
     ssq.IncludeThesaurus = SearchFlags.Items[1].Selected;
     ssq.IncludePhonic = SearchFlags.Items[2].Selected;
     ssq.WhichPage = whichResultsPage;
     ssq.ItemsPerPage = 10;
     _State.SelectedIndexes.Clear();
     for (int i = 0; i < _Indexes.Count; i++)
     {
         CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + i.ToString());
         if ((thisIndex != null) && (thisIndex.Checked))
         {
             ssq.Indexes.Add(new SpeedSearchIndex(_Indexes[i].IndexName, _Indexes[i].Type.Value, _Indexes[i].IsSecure ?? false));
             _State.SelectedIndexes.Add(i);
         }
     }
     if (ssq.Indexes.Count == 0)
     {
         throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Index_Required").ToString());
     }
     CheckBox freqfilter = (CheckBox)PlaceHolder2.FindControl("FreqUsed");
     if ((freqfilter != null) && (freqfilter.Checked))
     {
         ssq.UseFrequentFilter = true;
     }
     foreach (SlxFieldDefinition fd in _SearchFilters.Values)
     {
         TextBox filter = (TextBox)PlaceHolder2.FindControl(fd.DisplayName);
         if ((filter != null) && (!string.IsNullOrEmpty(filter.Text)))
         {
             ssq.Filters.Add(new SpeedSearchFilter(fd.DisplayName, filter.Text, fd.CommonIndexes, fd.FieldType, fd.IndexType));
         }
     }
     return ssq;
 }
Ejemplo n.º 7
0
 private SpeedSearchQuery BuildQuery()
 {
     SpeedSearchQuery ssq = new SpeedSearchQuery();
     ssq.SearchText = SearchRequest.Text;
     ssq.SearchType = SearchType.SelectedIndex;
     ssq.IncludeStemming = SearchFlags.Items[0].Selected;
     ssq.IncludeThesaurus = SearchFlags.Items[1].Selected;
     ssq.IncludePhonic = SearchFlags.Items[2].Selected;
     ssq.WhichPage = whichResultsPage;
     ssq.ItemsPerPage = 10;
     for (int i = 0; i < _Indexes.Count; i++)
     {
         CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + i.ToString());
         if ((thisIndex != null) && (thisIndex.Checked))
         {
             ssq.Indexes.Add(_Indexes[i].IndexName);
             _State.SelectedIndexes.Add(i);
         }
     }
     CheckBox freqfilter = (CheckBox)PlaceHolder2.FindControl("FreqUsed");
     if ((freqfilter != null) && (freqfilter.Checked))
     {
         ssq.UseFrequentFilter = true;
     }
     foreach (SlxFieldDefinition fd in _SearchFilters.Values)
     {
         TextBox filter = (TextBox)PlaceHolder2.FindControl(fd.DisplayName);
         if ((filter != null) && (!string.IsNullOrEmpty(filter.Text)))
         {
             ssq.Filters.Add(new SpeedSearchFilter(fd.DisplayName, filter.Text, fd.CommonIndexes, fd.FieldType, fd.IndexType));
         }
     }
     return ssq;
 }