/// <summary>
        /// Filters search results by page types.
        /// </summary>
        /// <param name="pageTypes"></param>
        public void FilterByPageTypes(params string[] pageTypes)
        {
            Verify.ArgumentNotNull(pageTypes, nameof(pageTypes));

            Selection.Add(new SearchQuerySelection
            {
                FieldName = DocumentFieldNames.GetFieldName(typeof(IPage), nameof(IPage.PageTypeId)),
                Operation = SearchQuerySelectionOperation.Or,
                Values    = pageTypes
            });
        }
Beispiel #2
0
        public static Tuple <string, string>[] GetFacetOptions()
        {
            var toSkip = new []
            {
                DocumentFieldNames.GetFieldName(typeof(IPublishControlled), nameof(IPublishControlled.PublicationStatus)),
                DocumentFieldNames.GetFieldName(typeof(IChangeHistory), nameof(IChangeHistory.ChangedBy)),
                DocumentFieldNames.DataType
            };

            var facetFields = SearchFacade.DocumentSources
                              .SelectMany(ds => ds.CustomFields)
                              .Where(f => f.FacetedSearchEnabled && f.Label != null &&
                                     !toSkip.Contains(f.Name))
                              .Select(f => new Tuple <string, string>(f.Name, GetFacetLabel(f)));

            return(IgnoreDuplicates(facetFields, t => t.Item1).OrderBy(t => t.Item2).ToArray());
        }