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


C# ISearchService.Search方法代码示例

本文整理汇总了C#中ISearchService.Search方法的典型用法代码示例。如果您正苦于以下问题:C# ISearchService.Search方法的具体用法?C# ISearchService.Search怎么用?C# ISearchService.Search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISearchService的用法示例。


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

示例1: SearchModule

    public SearchModule (ISearchService<BlogPost> searchService, IBlogService blogService) : base(blogService)
    {
      Get["/search"] = p =>
                         {
                           var query = this.Bind<SearchQuery>();
                           var result = searchService.Search(query.Query, query.Page, 5);

                           ViewBag.SearchQuery = query.Query;
                           
                           return View["Index", result];
                         };
    }
开发者ID:garethrhughes,项目名称:grhughes.com.Website,代码行数:12,代码来源:SearchModule.cs

示例2: GetResultsFromSearchService

        public static async Task<IQueryable<Package>> GetResultsFromSearchService(ISearchService searchService, SearchFilter searchFilter)
        {
            var result = await searchService.Search(searchFilter);

            // For count queries, we can ask the SearchService to not filter the source results. This would avoid hitting the database and consequently make
            // it very fast.
            if (searchFilter.CountOnly)
            {
                // At this point, we already know what the total count is. We can have it return this value very quickly without doing any SQL.
                return result.Data.InterceptWith(new CountInterceptor(result.Hits));
            }

            // For relevance search, Lucene returns us a paged\sorted list. OData tries to apply default ordering and Take \ Skip on top of this.
            // We avoid it by yanking these expressions out of out the tree.
            return result.Data.InterceptWith(new DisregardODataInterceptor());
        }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:16,代码来源:SearchAdaptor.cs

示例3: GetResultsFromSearchService

 private static async Task<IQueryable<Package>> GetResultsFromSearchService(ISearchService searchService, SearchFilter searchFilter)
 {
     var result = await searchService.Search(searchFilter);
     return FormatResults(searchFilter, result);
 }
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:5,代码来源:SearchAdaptor.cs


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