当前位置: 首页>>代码示例>>C#>>正文


C# SearchFilter类代码示例

本文整理汇总了C#中SearchFilter的典型用法代码示例。如果您正苦于以下问题:C# SearchFilter类的具体用法?C# SearchFilter怎么用?C# SearchFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SearchFilter类属于命名空间,在下文中一共展示了SearchFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Search

        public async Task<SearchResults> Search(SearchFilter filter)
        {
            // Convert the query
            string query = BuildLuceneQuery(filter.SearchTerm);

            // Query!
            var result = await _client.Search(
                query,
                projectTypeFilter: null,
                includePrerelease: filter.IncludePrerelease,
                curatedFeed: filter.CuratedFeed == null ? null : filter.CuratedFeed.Name,
                sortBy: filter.SortOrder,
                skip: filter.Skip,
                take: filter.Take,
                isLuceneQuery: true,
                countOnly: filter.CountOnly,
                explain: false,
                getAllVersions: false);

            result.HttpResponse.EnsureSuccessStatusCode();
            var content = await result.ReadContent();
            if (filter.CountOnly || content.TotalHits == 0)
            {
                return new SearchResults(content.TotalHits);
            }
            return new SearchResults(
                content.TotalHits, 
                content.Data.Select(ReadPackage).AsQueryable());
        }
开发者ID:rrudduck,项目名称:NuGetGallery,代码行数:29,代码来源:ExternalSearchService.cs

示例2: GetSearchFilter

        public static SearchFilter GetSearchFilter(string q, int page, string sortOrder, string context)
        {
            var searchFilter = new SearchFilter(context)
            {
                SearchTerm = q,
                Skip = (page - 1) * Constants.DefaultPackageListPageSize, // pages are 1-based. 
                Take = Constants.DefaultPackageListPageSize,
                IncludePrerelease = true
            };

            switch (sortOrder)
            {
                case Constants.AlphabeticSortOrder:
                    searchFilter.SortOrder = SortOrder.TitleAscending;
                    break;

                case Constants.RecentSortOrder:
                    searchFilter.SortOrder = SortOrder.Published;
                    break;

                default:
                    searchFilter.SortOrder = SortOrder.Relevance;
                    break;
            }

            return searchFilter;
        }
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:27,代码来源:SearchAdaptor.cs

示例3: GetRemoteExtensions

        public async Task<IEnumerable<SiteExtensionInfo>> GetRemoteExtensions(string filter, bool allowPrereleaseVersions, string feedUrl)
        {
            ITracer tracer = _traceFactory.GetTracer();
            var extensions = new List<SiteExtensionInfo>();
            SourceRepository remoteRepo = GetRemoteRepository(feedUrl);

            SearchFilter filterOptions = new SearchFilter();
            filterOptions.IncludePrerelease = allowPrereleaseVersions;

            IEnumerable<UIPackageMetadata> packages = null;

            using (tracer.Step("Search site extensions by filter: {0}", filter))
            {
                packages = (await remoteRepo.Search(string.IsNullOrWhiteSpace(filter) ? string.Empty : filter, filterOptions: filterOptions))
                            .OrderByDescending(p => p.DownloadCount);
            }

            using (tracer.Step("Convert search result to SiteExtensionInfos"))
            {
                var convertedResult = await ConvertNuGetPackagesToSiteExtensionInfos(
                    packages,
                    async (uiPackage) =>
                    {
                        return await ConvertRemotePackageToSiteExtensionInfo(uiPackage, feedUrl);
                    });

                extensions.AddRange(convertedResult);
            }

            return extensions;
        }
开发者ID:projectkudu,项目名称:kudu,代码行数:31,代码来源:SiteExtensionManager.cs

示例4: CreateFilter

 internal static SearchFilter CreateFilter(string searchString, SearchableEditorWindow.SearchMode searchMode)
 {
   SearchFilter filter = new SearchFilter();
   if (string.IsNullOrEmpty(searchString))
     return filter;
   switch (searchMode)
   {
     case SearchableEditorWindow.SearchMode.All:
       if (!SearchUtility.ParseSearchString(searchString, filter))
       {
         filter.nameFilter = searchString;
         filter.classNames = new string[1]{ searchString };
         filter.assetLabels = new string[1]{ searchString };
         filter.assetBundleNames = new string[1]{ searchString };
         filter.showAllHits = true;
         break;
       }
       break;
     case SearchableEditorWindow.SearchMode.Name:
       filter.nameFilter = searchString;
       break;
     case SearchableEditorWindow.SearchMode.Type:
       filter.classNames = new string[1]{ searchString };
       break;
     case SearchableEditorWindow.SearchMode.Label:
       filter.assetLabels = new string[1]{ searchString };
       break;
     case SearchableEditorWindow.SearchMode.AssetBundleName:
       filter.assetBundleNames = new string[1]{ searchString };
       break;
   }
   return filter;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:33,代码来源:SearchableEditorWindow.cs

示例5: SavedFilter

 public SavedFilter(string name, SearchFilter filter, int depth, float previewSize)
 {
   this.m_Name = name;
   this.m_Depth = depth;
   this.m_Filter = filter;
   this.m_PreviewSize = previewSize;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:SavedFilter.cs

示例6: DoDrag

 public override DragAndDropVisualMode DoDrag(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
 {
     if (targetItem == null)
     {
         return DragAndDropVisualMode.None;
     }
     object genericData = DragAndDrop.GetGenericData(ProjectWindowUtil.k_DraggingFavoriteGenericData);
     if (genericData != null)
     {
         int instanceID = (int) genericData;
         if ((targetItem is SearchFilterTreeItem) && (parentItem is SearchFilterTreeItem))
         {
             bool flag = SavedSearchFilters.CanMoveSavedFilter(instanceID, parentItem.id, targetItem.id, dropPos == TreeViewDragging.DropPosition.Below);
             if (flag && perform)
             {
                 SavedSearchFilters.MoveSavedFilter(instanceID, parentItem.id, targetItem.id, dropPos == TreeViewDragging.DropPosition.Below);
                 int[] selectedIDs = new int[] { instanceID };
                 base.m_TreeView.SetSelection(selectedIDs, false);
                 base.m_TreeView.NotifyListenersThatSelectionChanged();
             }
             return (!flag ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy);
         }
         return DragAndDropVisualMode.None;
     }
     if ((targetItem is SearchFilterTreeItem) && (parentItem is SearchFilterTreeItem))
     {
         string str = DragAndDrop.GetGenericData(ProjectWindowUtil.k_IsFolderGenericData) as string;
         if (str != "isFolder")
         {
             return DragAndDropVisualMode.None;
         }
         if (perform)
         {
             Object[] objectReferences = DragAndDrop.objectReferences;
             if (objectReferences.Length > 0)
             {
                 string assetPath = AssetDatabase.GetAssetPath(objectReferences[0].GetInstanceID());
                 if (!string.IsNullOrEmpty(assetPath))
                 {
                     string name = new DirectoryInfo(assetPath).Name;
                     SearchFilter filter = new SearchFilter();
                     filter.folders = new string[] { assetPath };
                     bool addAsChild = targetItem == parentItem;
                     float listAreaGridSize = ProjectBrowserColumnOneTreeViewGUI.GetListAreaGridSize();
                     int num3 = SavedSearchFilters.AddSavedFilterAfterInstanceID(name, filter, listAreaGridSize, targetItem.id, addAsChild);
                     int[] numArray2 = new int[] { num3 };
                     base.m_TreeView.SetSelection(numArray2, false);
                     base.m_TreeView.NotifyListenersThatSelectionChanged();
                 }
                 else
                 {
                     Debug.Log("Could not get asset path from id " + objectReferences[0].GetInstanceID());
                 }
             }
         }
         return DragAndDropVisualMode.Copy;
     }
     return base.DoDrag(parentItem, targetItem, perform, dropPos);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:59,代码来源:ProjectBrowserColumnOneTreeViewDragging.cs

示例7: AddSearchFilter

 private void AddSearchFilter (TrackFilterType id, string field, string title)
 {
     SearchFilter filter = new SearchFilter ();
     filter.Id = (int)id;
     filter.Field = field;
     filter.Title = title;
     search_filters.Add (filter.Id, filter);
 }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:8,代码来源:SearchEntry.cs

示例8: BeginCreateSavedFilter

 internal virtual void BeginCreateSavedFilter(SearchFilter filter)
 {
     string displayName = "New Saved Search";
     this.m_IsCreatingSavedFilter = true;
     int id = SavedSearchFilters.AddSavedFilter(displayName, filter, GetListAreaGridSize());
     base.m_TreeView.Frame(id, true, false);
     base.m_TreeView.state.renameOverlay.BeginRename(displayName, id, 0f);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:ProjectBrowserColumnOneTreeViewGUI.cs

示例9: DoDrag

 public override DragAndDropVisualMode DoDrag(TreeViewItem parentItem, TreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
 {
     if (targetItem == null)
     {
         return DragAndDropVisualMode.None;
     }
     object genericData = DragAndDrop.GetGenericData(ProjectWindowUtil.k_DraggingFavoriteGenericData);
     if (genericData != null)
     {
         int instanceID = (int) genericData;
         if (!(targetItem is SearchFilterTreeItem) || !(parentItem is SearchFilterTreeItem))
         {
             return DragAndDropVisualMode.None;
         }
         bool flag = SavedSearchFilters.CanMoveSavedFilter(instanceID, parentItem.id, targetItem.id, true);
         if (flag && perform)
         {
             SavedSearchFilters.MoveSavedFilter(instanceID, parentItem.id, targetItem.id, true);
         }
         return (!flag ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy);
     }
     if (!(targetItem is SearchFilterTreeItem) || !(parentItem is SearchFilterTreeItem))
     {
         return base.DoDrag(parentItem, targetItem, perform, dropPos);
     }
     string str = DragAndDrop.GetGenericData(ProjectWindowUtil.k_IsFolderGenericData) as string;
     if (!(str == "isFolder"))
     {
         return DragAndDropVisualMode.None;
     }
     if (perform)
     {
         UnityEngine.Object[] objectReferences = DragAndDrop.objectReferences;
         if (objectReferences.Length > 0)
         {
             HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
             if (property.Find(objectReferences[0].GetInstanceID(), null))
             {
                 SearchFilter filter = new SearchFilter();
                 string assetPath = AssetDatabase.GetAssetPath(property.instanceID);
                 if (!string.IsNullOrEmpty(assetPath))
                 {
                     filter.folders = new string[] { assetPath };
                     bool addAsChild = targetItem == parentItem;
                     float listAreaGridSize = ProjectBrowserColumnOneTreeViewGUI.GetListAreaGridSize();
                     Selection.activeInstanceID = SavedSearchFilters.AddSavedFilterAfterInstanceID(property.name, filter, listAreaGridSize, targetItem.id, addAsChild);
                 }
                 else
                 {
                     Debug.Log("Could not get asset path from id " + property.name);
                 }
             }
         }
     }
     return DragAndDropVisualMode.Copy;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:56,代码来源:ProjectBrowserColumnOneTreeViewDragging.cs

示例10: FilterSettingsChanged

 private void FilterSettingsChanged()
 {
     SearchFilter searchFilter = new SearchFilter();
     searchFilter.SearchFieldStringToFilter(this.m_SearchFilter);
     if (!string.IsNullOrEmpty(this.m_RequiredType))
     {
         searchFilter.classNames = new string[] { this.m_RequiredType };
     }
     this.m_ListArea.Init(this.listPosition, !this.m_IsShowingAssets ? HierarchyType.GameObjects : HierarchyType.Assets, searchFilter, true);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:ObjectSelector.cs

示例11: SetSearchFilter

 internal void SetSearchFilter(SearchFilter filter)
 {
     if (UnityConnect.instance.userInfo.whitelisted && Collab.instance.collabInfo.whitelisted)
     {
         this.SetSearchFilterINTERNAL(SearchFilter.Split(filter.nameFilter), filter.classNames, filter.assetLabels, filter.assetBundleNames, filter.versionControlStates, filter.referencingInstanceIDs, filter.scenePaths, filter.showAllHits);
     }
     else
     {
         this.SetSearchFilterINTERNAL(SearchFilter.Split(filter.nameFilter), filter.classNames, filter.assetLabels, filter.assetBundleNames, new string[0], filter.referencingInstanceIDs, filter.scenePaths, filter.showAllHits);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:11,代码来源:HierarchyProperty.cs

示例12: Index

 public ActionResult Index(SearchFilter filter)
 {
     if (ModelState.IsValid)
     {
         FileSearchResult result = _searchService.GetFile(filter);
         if(result != null)
             return PartialView("SearchResult",result);
         ModelState.AddModelError("", ErrorResources.NotFound);
     }
     return PartialView(filter);
 }
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:11,代码来源:SearchController.cs

示例13: GetRawResultsFromSearchService

        private static async Task<IQueryable<Package>> GetRawResultsFromSearchService(ISearchService searchService, SearchFilter searchFilter)
        {
            var externalSearchService = searchService as ExternalSearchService;
            if (externalSearchService != null)
            {
                var result = await externalSearchService.RawSearch(searchFilter);
                return FormatResults(searchFilter, result);
            }

            return await GetResultsFromSearchService(searchService, searchFilter);
        }
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:11,代码来源:SearchAdaptor.cs

示例14: Search

        /// <summary>
        /// Query result by search term, always include pre-released
        /// </summary>
        public static async Task<IEnumerable<UISearchMetadata>> Search(this SourceRepository srcRepo, string searchTerm, SearchFilter filterOptions = null, int skip = 0, int take = 1000)
        {
            // always include pre-release package
            if (filterOptions == null)
            {
                filterOptions = new SearchFilter();
            }

            filterOptions.IncludePrerelease = true; // keep the good old behavior
            var searchResource = await srcRepo.GetResourceAsync<UISearchResource>();
            return await searchResource.Search(searchTerm, filterOptions, skip, take, CancellationToken.None);
        }
开发者ID:HenrikFrystykNielsen,项目名称:kudu,代码行数:15,代码来源:FeedExtensions.cs

示例15: SearchCore

        private async Task<SearchResults> SearchCore(SearchFilter filter, bool raw)
        {
            // Query!
            var sw = new Stopwatch();
            sw.Start();
            var result = await _client.Search(
                filter.SearchTerm,
                projectTypeFilter: null,
                includePrerelease: filter.IncludePrerelease,
                curatedFeed: filter.CuratedFeed == null ? null : filter.CuratedFeed.Name,
                sortBy: filter.SortOrder,
                skip: filter.Skip,
                take: filter.Take,
                isLuceneQuery: raw,
                countOnly: filter.CountOnly,
                explain: false,
                getAllVersions: filter.IncludeAllVersions);
			sw.Stop();

            SearchResults results = null;
            if (result.IsSuccessStatusCode)
            {
                var content = await result.ReadContent();
                if (filter.CountOnly || content.TotalHits == 0)
                {
                    results = new SearchResults(content.TotalHits);
                }
                else
                {
                    results = new SearchResults(
                        content.TotalHits,
                        content.Data.Select(ReadPackage).AsQueryable());
                }
            }

            Trace.PerfEvent(
                SearchRoundtripTimePerfCounter,
                sw.Elapsed,
                new Dictionary<string, object>() {
                    {"Term", filter.SearchTerm},
                    {"Context", filter.Context},
                    {"Raw", raw},
                    {"Hits", results == null ? -1 : results.Hits},
                    {"StatusCode", (int)result.StatusCode},
                    {"SortOrder", filter.SortOrder.ToString()},
                    {"CuratedFeed", filter.CuratedFeed == null ? null : filter.CuratedFeed.Name},
                    {"Url", TryGetUrl()}
                });

            result.HttpResponse.EnsureSuccessStatusCode();
            return results;
        }
开发者ID:rlwilkerson,项目名称:NuGetGallery,代码行数:52,代码来源:ExternalSearchService.cs


注:本文中的SearchFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。