Ejemplo n.º 1
0
        protected virtual void SearchText(ISearchHelper searchHelper, QueryList query)
        {
            if (string.IsNullOrWhiteSpace(Text))
            {
                return;
            }

            string text = Regex.Replace(Text, @"[^\wæøåÆØÅ\-@\. ]", string.Empty).ToLowerInvariant().Trim();

            string[] terms = text.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (terms.Length == 0)
            {
                return;
            }

            // Fallback if no fields are added
            FieldList fields = GetTextFields(searchHelper);

            if (fields == null || fields.Count == 0)
            {
                fields = FieldList.GetFromStringArray(new[] { "nodeName_lci", "contentTeasertext_lci", "contentBody_lci" });
            }

            query.Add(fields.GetQuery(terms));
        }
Ejemplo n.º 2
0
 protected virtual void SearchHideFromSearch(ISearchHelper searchHelper, QueryList query)
 {
     if (DisableHideFromSearch)
     {
         return;
     }
     query.Add("hideFromSearch:0");
 }
Ejemplo n.º 3
0
 protected virtual void SearchPath(ISearchHelper searchHelper, QueryList query)
 {
     if (RootIds == null || RootIds.Length == 0)
     {
         return;
     }
     query.Add("(" + string.Join(" OR ", from id in RootIds select "path_search:" + id) + ")");
 }
 protected override void SearchType(ISearchHelper helper, QueryList query)
 {
     if (ContentTypes == null || ContentTypes.Count == 0)
     {
         return;
     }
     query.AppendNodeTypeAliases(ContentTypes);
 }
Ejemplo n.º 5
0
        protected virtual QueryList GetQueryList(ISearchHelper searchHelper)
        {
            QueryList query = new QueryList();

            SearchType(searchHelper, query);
            SearchText(searchHelper, query);
            SearchPath(searchHelper, query);
            SearchHideFromSearch(searchHelper, query);

            return(query);
        }
        protected virtual void SearchText(ISearchHelper searchHelper, QueryList query)
        {
            if (Text == null)
            {
                return;
            }

            string textQuery = Text.GetRawQuery();

            if (string.IsNullOrWhiteSpace(textQuery))
            {
                return;
            }

            query.Add(textQuery);
        }
 /// <summary>
 /// Appends the specified <paramref name="queryList"/> to the query list
 /// </summary>
 /// <typeparam name="T">The type of the query list.</typeparam>
 /// <param name="list">The query list to which <paramref name="queryList"/> should be added.</param>
 /// <param name="queryList">The query list to be added.</param>
 /// <returns><paramref name="list"/> - useful for method chaining.</returns>
 public static T Append <T>(this T list, QueryList queryList) where T : QueryList
 {
     list?.Add(queryList);
     return(list);
 }
Ejemplo n.º 8
0
 protected virtual void SearchType(ISearchHelper searchHelper, QueryList query)
 {
 }