示例#1
0
        /// <summary>
        /// Invokes the associated search service of the represented <see cref="T:Remotion.ObjectBinding.Web.UI.Controls.BocAutoCompleteReferenceValue"/>
        /// and returns its results.
        /// </summary>
        /// <param name="searchText">Text to search for.</param>
        /// <param name="completionSetCount">Auto completion set count.</param>
        /// <returns>The completion set as list of <see cref="SearchServiceResultItem"/> or an empty list if the completion set has been empty.</returns>
        public IReadOnlyList <SearchServiceResultItem> GetSearchServiceResults([NotNull] string searchText, int completionSetCount)
        {
            ArgumentUtility.CheckNotNullOrEmpty("searchText", searchText);

            var inputScopeID = GetInputScopeID();

            var searchServiceRequestScript = CommonJavaScripts.CreateAutoCompleteSearchServiceRequest(inputScopeID, searchText, completionSetCount);
            var response = (IReadOnlyDictionary <string, object>)Context.Browser.Driver.ExecuteScript(searchServiceRequestScript, Scope);

            return(ParseSearchServiceResponse(response));
        }
示例#2
0
        /// <summary>
        /// Invokes the associated exact search service of the represented
        /// <see cref="T:Remotion.ObjectBinding.Web.UI.Controls.BocAutoCompleteReferenceValue"/> and returns its result.
        /// </summary>
        /// <param name="searchText">Text to search for.</param>
        /// <returns>The exact search result as <see cref="SearchServiceResultItem"/> or null if no result has been found.</returns>
        public SearchServiceResultItem GetExactSearchServiceResult([NotNull] string searchText)
        {
            ArgumentUtility.CheckNotNullOrEmpty("searchText", searchText);

            var inputScopeId = GetInputScopeID();

            var searchServiceRequestScript = CommonJavaScripts.CreateAutoCompleteExactSearchServiceRequest(inputScopeId, searchText);
            var response = (IReadOnlyDictionary <string, object>)Context.Browser.Driver.ExecuteScript(searchServiceRequestScript, Scope);

            return(ParseSearchServiceResponse(response).SingleOrDefault());
        }