• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SearchFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ParseSearchString

 internal static bool ParseSearchString(string searchText, SearchFilter filter)
 {
     if (string.IsNullOrEmpty(searchText))
     {
         return false;
     }
     filter.ClearSearch();
     string searchString = string.Copy(searchText);
     RemoveUnwantedWhitespaces(ref searchString);
     bool flag = false;
     int startIndex = FindFirstPositionNotOf(searchString, " \t,");
     if (startIndex == -1)
     {
         startIndex = 0;
     }
     while (startIndex < searchString.Length)
     {
         int length = searchString.IndexOfAny(" \t,".ToCharArray(), startIndex);
         int index = searchString.IndexOf('"', startIndex);
         int num4 = -1;
         if (index != -1)
         {
             num4 = searchString.IndexOf('"', index + 1);
             if (num4 != -1)
             {
                 length = searchString.IndexOfAny(" \t,".ToCharArray(), num4);
             }
             else
             {
                 length = -1;
             }
         }
         if (length == -1)
         {
             length = searchString.Length;
         }
         if (length > startIndex)
         {
             string str3 = searchString.Substring(startIndex, length - startIndex);
             if (ParseSingleWord(str3, filter, index, num4))
             {
                 flag = true;
             }
             else
             {
                 filter.nameFilter = filter.nameFilter + (!string.IsNullOrEmpty(filter.nameFilter) ? " " : string.Empty) + str3;
             }
         }
         startIndex = length + 1;
     }
     return flag;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:52,代码来源:SearchUtility.cs


示例17: ParseSearchString

		internal static bool ParseSearchString(string searchText, SearchFilter filter)
		{
			if (string.IsNullOrEmpty(searchText))
			{
				return false;
			}
			filter.ClearSearch();
			string text = string.Copy(searchText);
			SearchUtility.RemoveUnwantedWhitespaces(ref text);
			bool result = false;
			int i = SearchUtility.FindFirstPositionNotOf(text, " \t,");
			if (i == -1)
			{
				i = 0;
			}
			while (i < text.Length)
			{
				int num = text.IndexOfAny(" \t,".ToCharArray(), i);
				int num2 = text.IndexOf('"', i);
				int num3 = -1;
				if (num2 != -1)
				{
					num3 = text.IndexOf('"', num2 + 1);
					if (num3 != -1)
					{
						num = text.IndexOfAny(" \t,".ToCharArray(), num3);
					}
					else
					{
						num = -1;
					}
				}
				if (num == -1)
				{
					num = text.Length;
				}
				if (num > i)
				{
					string text2 = text.Substring(i, num - i);
					if (SearchUtility.ParseSingleWord(text2, filter, num2, num3))
					{
						result = true;
					}
					else
					{
						filter.nameFilter = filter.nameFilter + ((!string.IsNullOrEmpty(filter.nameFilter)) ? " " : string.Empty) + text2;
					}
				}
				i = num + 1;
			}
			return result;
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:52,代码来源:SearchUtility.cs


示例18: FindAssetsOfType

 private static List<UnityEngine.Object> FindAssetsOfType(string[] classNames)
 {
     HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     SearchFilter filter = new SearchFilter {
         classNames = classNames
     };
     property.SetSearchFilter(filter);
     List<UnityEngine.Object> list = new List<UnityEngine.Object>();
     while (property.Next(null))
     {
         list.Add(property.pptrValue);
     }
     return list;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:14,代码来源:AssetSelectionPopupMenu.cs


示例19: GetEventByName

        public Entities.Event GetEventByName(string eventName)
        {
            var eventNameFilter = new SearchFilter<Entities.Event>
                                      {
                                          Conditional = SearchConditional.Equals,
                                          PropertyName = "Name",
                                          PropertyValue = eventName
                                      };

            var eventSearchCriteria = new EventsSearchCriteria
                                          {
                                              Filters = new List<SearchFilter<Entities.Event>> {eventNameFilter}
                                          };
            return Repository.List<Entities.Event>(eventSearchCriteria.BuildCriteria()).FirstOrDefault();
        }
开发者ID:dotnet236,项目名称:LHASocialWork,代码行数:15,代码来源:EventService.cs


示例20: TryReadElementFromXml

 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.BaseFolderIds:
             this.RootFolderIds.InternalClear();
             this.RootFolderIds.LoadFromXml(reader, reader.LocalName);
             return true;
         case XmlElementNames.Restriction:
             reader.Read();
             this.searchFilter = SearchFilter.LoadFromXml(reader);
             return true;
         default:
             return false;
     }
 }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:21,代码来源:SearchFolderParameters.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SearchFlags类代码示例发布时间:2022-05-24
下一篇:
C# SearchDescriptor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap