コード例 #1
0
        private string GetQueryForAllMatchingDocumentsForIndex(AbstractViewGenerator generator)
        {
            var terms = new TermsQueryRunner(Database)
                        .GetTerms(Constants.DocumentsByEntityNameIndex, "Tag", null, int.MaxValue);

            var sb = new StringBuilder();

            foreach (var entityName in generator.ForEntityNames)
            {
                bool added = false;
                foreach (var term in terms)
                {
                    if (string.Equals(entityName, term, StringComparison.OrdinalIgnoreCase))
                    {
                        AppendTermToQuery(term, sb);
                        added = true;
                    }
                }
                if (added == false)
                {
                    AppendTermToQuery(entityName, sb);
                }
            }

            return(sb.ToString());
        }
コード例 #2
0
        private string GetQueryForAllMatchingDocumentsForIndex(AbstractViewGenerator generator)
        {
            var terms = new TermsQueryRunner(Database).GetTerms(Constants.DocumentsByEntityNameIndex, "Tag", null, int.MaxValue);

            var sb = new StringBuilder();

            foreach (var entityName in generator.ForEntityNames)
            {
                foreach (var term in terms)
                {
                    if (string.Equals(entityName, term, StringComparison.OrdinalIgnoreCase))
                    {
                        if (sb.Length != 0)
                        {
                            sb.Append(" OR ");
                        }

                        sb.Append("Tag:[[").Append(term).Append("]]");
                    }
                }
            }

            var query = sb.ToString();

            return(query);
        }
コード例 #3
0
ファイル: QueryBuilder.cs プロジェクト: xinix00/ravendb
        private static void GetQueryForAllMatchingDocumentsForIndex(
            DocumentDatabase database, HashSet <string> entityNames, StringBuilder sb)
        {
            var terms = new TermsQueryRunner(database)
                        .GetTerms(Constants.DocumentsByEntityNameIndex, "Tag", null, int.MaxValue);

            foreach (var entityName in entityNames)
            {
                bool added = false;
                foreach (var term in terms)
                {
                    if (string.Equals(entityName, term, StringComparison.OrdinalIgnoreCase))
                    {
                        AppendTermToQuery(term, sb);
                        added = true;
                    }
                }
                if (added == false)
                {
                    AppendTermToQuery(entityName, sb);
                }
            }
        }