Ejemplo n.º 1
0
 public bool IsValid(SearchTerms st)
 {
     return (st.HasTerms) ||
         (SectionsToSearch != null && SectionsToSearch.Length > 0) ||
         (UsersToSearch != null && UsersToSearch.Length > 0) ||
         (GroupToSearch != null && GroupToSearch.Length > 0);
 }
Ejemplo n.º 2
0
Archivo: Search.cs Proyecto: pcstx/OA
 protected abstract SearchResultSet GetSearchResults(SearchQuery query, SearchTerms terms);
Ejemplo n.º 3
0
Archivo: Search.cs Proyecto: pcstx/OA
        protected static SearchTerms GetSearchTerms(SearchQuery query)
        {
            SearchTerms st = new SearchTerms();
            ArrayList searchKeywords;
            //bool performLikeMatch = false; // Never Used
            string[] andTerms;
            string[] orTerms;

            // Clean the search terms
            //
            string searchTerms = Regex.Replace(query.SearchTerms, "[^\\w]", " ", RegexOptions.Compiled | RegexOptions.Multiline);

            // Added by [email protected]
            bool toHashcode = (SiteSettingsManager.GetSiteSettings().SearchMode == SearchMode.ForumsIndexer);
            searchKeywords = TokenizeKeywords(searchTerms, toHashcode);

            /* Commented by [email protected]
            // Tokenize the search terms and determine if we need to perform partial match
            //
            if (searchTerms.IndexOf("*") != 0)
            {
                //performLikeMatch = false;
                searchKeywords = TokenizeKeywords(searchTerms, true);
            }
            else
            {
                //performLikeMatch = true;
                searchKeywords = TokenizeKeywords(searchTerms, false);
            }
            */

            // Do we have users that we are searching for?
            //
            //            if ((usersToSearch[0] == "") || (usersToSearch[0] == "0"))
            //                usersToSearch = null;

            // If we don't have any results
            //
            //            if ((searchKeywords.Count == 0) && (query.UsersToSearch == null))
            //                throw new CSException(CSExceptionType.SearchNoResults);

            // Get the terms divided into and/or sets
            //
            // Modified by [email protected]
            // add "toHashcode" parameter
            GetAndOrKeywords (searchKeywords, toHashcode, out andTerms, out orTerms);

            st.And = andTerms;
            st.Or = orTerms;

            return st;
        }