private SearchResult initialQuery(SearchRequest req)
        {
            SearchResult sr;

            if (req.text == null || req.text.Length == 0 ||
                (req.text.Length == 1 && req.text[0].Trim() == ""))
            {
                sr            = new SearchResult();
                sr.statusCode = WebServiceBackEnd.SC_INVALID_QUERY;
                sr.statusMsg  = "No search terms specified";
                return(sr);
            }

            remoteChannel.Register();

            if (remoteObj == null)
            {
                remoteObj = new WebServiceBackEnd();
            }

            bool isLocalReq = HttpContext.Current.Request.Url.IsLoopback;

            if ((remoteObj == null) || !(remoteObj.allowGlobalAccess || isLocalReq))
            {
                return(restrictedAccessResult());
            }

            sr = remoteObj.doQuery(req, isLocalReq);
            return(sr);
        }
        public SearchResult GetResults(GetResultsRequest req)
        {
            SearchResult sr;

            if (req.searchToken == null | req.searchToken == "")
            {
                sr            = new SearchResult();
                sr.statusCode = WebServiceBackEnd.SC_INVALID_SEARCH_TOKEN;
                sr.statusMsg  = "Invalid Search Token";
            }

            remoteChannel.Register();

            if (remoteObj == null)
            {
                remoteObj = new WebServiceBackEnd();
            }

            bool isLocalReq = HttpContext.Current.Request.Url.IsLoopback;

            if ((remoteObj == null) || !(remoteObj.allowGlobalAccess || isLocalReq))
            {
                return(restrictedAccessResult());
            }

            sr = remoteObj.getResults(req, isLocalReq);
            return(sr);
        }
        public HitSnippet[] GetSnippets(GetSnippetsRequest req)
        {
            HitSnippet[] response;

            if (req.searchToken == null | req.searchToken == "")
            {
                response = new HitSnippet[0];
                return(response);
            }

            remoteChannel.Register();

            if (remoteObj == null)
            {
                remoteObj = new WebServiceBackEnd();
            }

            bool isLocalReq = HttpContext.Current.Request.Url.IsLoopback;

            if ((remoteObj == null) || !(remoteObj.allowGlobalAccess || isLocalReq))
            {
                response = new HitSnippet[0];
                return(response);
            }

            if (req.hitHashCodes.Length < 1)
            {
                response = new HitSnippet[0];
            }
            else
            {
                response = remoteObj.getSnippets(req);
            }

            return(response);
        }