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


C# IQueryable.Search方法代码示例

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


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

示例1: Search

        /// <summary>
        /// Filter the list of Buggs by a search query.
        /// </summary>
        /// <param name="Results">The unfiltered set of Buggs.</param>
        /// <param name="Query">The query to use as a filter.</param>
        /// <returns>A filtered set of Buggs.</returns>
        public IQueryable<Bugg> Search( IQueryable<Bugg> Results, string Query )
        {
            using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString() + "(Query=" + Query + ")" ) )
            {
                // Also may want to revisit how we search since this could get inefficient for a big search set.
                IQueryable<Bugg> Buggs;
                try
                {
                    string QueryString = HttpUtility.HtmlDecode( Query.ToString() );
                    if( QueryString == null )
                    {
                        QueryString = "";
                    }

                    // Take out terms starting with a -
                    string[] Terms = QueryString.Split( "-, ;+".ToCharArray(), StringSplitOptions.RemoveEmptyEntries );
                    string TermsToUse = "";
                    foreach( string Term in Terms )
                    {
                        string CallId = GetFunctionCallId( Term ).ToString();
                        if( !TermsToUse.Contains( CallId ) )
                        {
                            TermsToUse = TermsToUse + "+" + CallId;
                        }
                    }

                    Buggs = (IQueryable<Bugg>)Results.Search( new string[] { "Pattern" }, TermsToUse.Split( "+".ToCharArray() ) );
                }
                catch( Exception Ex )
                {
                    Debug.WriteLine( "Exception in Search: " + Ex.ToString() );
                    Buggs = Results;
                }
                return Buggs;
            }
        }
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:42,代码来源:BuggRepository.cs

示例2: SearchCore

        public static async Task<IQueryable<Package>> SearchCore(
            ISearchService searchService,
            HttpRequestBase request,
            IQueryable<Package> packages, 
            string searchTerm, 
            string targetFramework, 
            bool includePrerelease,
            CuratedFeed curatedFeed)
        {
            SearchFilter searchFilter;
            // We can only use Lucene if the client queries for the latest versions (IsLatest \ IsLatestStable) versions of a package
            // and specific sort orders that we have in the index.
            if (TryReadSearchFilter(request.RawUrl, out searchFilter))
            {
                searchFilter.SearchTerm = searchTerm;
                searchFilter.IncludePrerelease = includePrerelease;
                searchFilter.CuratedFeed = curatedFeed;

                Trace.WriteLine("TODO: use target framework parameter - see #856" + targetFramework);

                var results = await GetResultsFromSearchService(searchService, searchFilter);

                return results;
            }

            if (!includePrerelease)
            {
                packages = packages.Where(p => !p.IsPrerelease);
            }

            return packages.Search(searchTerm);
        }
开发者ID:rrudduck,项目名称:NuGetGallery,代码行数:32,代码来源:SearchAdaptor.cs

示例3: SearchCore

        public static async Task<IQueryable<Package>> SearchCore(
            ISearchService searchService,
            HttpRequestBase request,
            IQueryable<Package> packages, 
            string searchTerm, 
            string targetFramework, 
            bool includePrerelease,
            CuratedFeed curatedFeed)
        {
            SearchFilter searchFilter;
            // We can only use Lucene if:
            //  a) We are looking for the latest version of a package OR the Index contains all versions of each package
            //  b) The sort order is something Lucene can handle
            if (TryReadSearchFilter(searchService.ContainsAllVersions, request.RawUrl, out searchFilter))
            {
                searchFilter.SearchTerm = searchTerm;
                searchFilter.IncludePrerelease = includePrerelease;
                searchFilter.CuratedFeed = curatedFeed;
                searchFilter.SupportedFramework = targetFramework;

                var results = await GetResultsFromSearchService(searchService, searchFilter);

                return results;
            }

            if (!includePrerelease)
            {
                packages = packages.Where(p => !p.IsPrerelease);
            }

            return packages.Search(searchTerm);
        }
开发者ID:juvchan,项目名称:SiteExtensionGallery,代码行数:32,代码来源:SearchAdaptor.cs

示例4: RecordQueryImpl

        IQueryable<Record> RecordQueryImpl(RecordQueryInputModel input, IQueryable<RecordIndex.Result> query)
        {
            if (input.Q.IsNotBlank())
            {
                query = query
                    .Search(r => r.Title, input.Q, boost: 10)
                    .Search(r => r.TitleN, input.Q)
                    .Search(r => r.Abstract, input.Q)
                    .Search(r => r.AbstractN, input.Q)
                    .Search(r => r.KeywordsN, input.Q);
            }

            if (input.K != null && input.K.Any())
            {
                foreach (var keyword in ParameterHelper.ParseMetadataKeywords(input.K))
                {
                    string k = keyword.Vocab + "/" + keyword.Value;
                    query = query.Where(r => r.Keywords.Contains(k));
                }
            }

            if (input.D != null)
            {
                query = query.Where(r => r.MetadataDate >= input.D);
            }

            var recordQuery = query.As<Record>(); // ravendb method to project from the index result type to the actual document type

            // allow N to be negative
            if (input.N >= 0)
            {
                recordQuery = recordQuery.Skip(input.P * input.N).Take(input.N);
            }

            return recordQuery;
        }
开发者ID:jncc,项目名称:topcat,代码行数:36,代码来源:RecordQueryer.cs


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