Beispiel #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));
        }