Esempio n. 1
0
 protected internal virtual void applyFilters(BatchStatisticsQuery query)
 {
     if (!string.ReferenceEquals(batchId, null))
     {
         query.batchId(batchId);
     }
     if (!string.ReferenceEquals(type, null))
     {
         query.type(type);
     }
     if (TRUE.Equals(withoutTenantId))
     {
         query.withoutTenantId();
     }
     if (tenantIds != null && tenantIds.Count > 0)
     {
         query.tenantIdIn(tenantIds.ToArray());
     }
     if (TRUE.Equals(suspended))
     {
         query.suspended();
     }
     if (FALSE.Equals(suspended))
     {
         query.active();
     }
 }
Esempio n. 2
0
        internal static IndexType GetIndexType(IDictionary <string, string> config)
        {
            string     type                = config[LuceneIndexImplementation.KEY_TYPE];
            IndexType  result              = null;
            Similarity similarity          = GetCustomSimilarity(config);
            bool?      toLowerCaseUnbiased = !string.ReferenceEquals(config[LuceneIndexImplementation.KEY_TO_LOWER_CASE], null) ? ParseBoolean(config[LuceneIndexImplementation.KEY_TO_LOWER_CASE], true) : null;
            Analyzer   customAnalyzer      = GetCustomAnalyzer(config);

            if (!string.ReferenceEquals(type, null))
            {
                // Use the built in alternatives... "exact" or "fulltext"
                if ("exact".Equals(type))
                {
                    // In the exact case we default to false
                    bool toLowerCase = TRUE.Equals(toLowerCaseUnbiased);

                    result = toLowerCase ? new CustomType(new LowerCaseKeywordAnalyzer(), true, similarity) : EXACT;
                }
                else if ("fulltext".Equals(type))
                {
                    // In the fulltext case we default to true
                    bool toLowerCase = !FALSE.Equals(toLowerCaseUnbiased);

                    Analyzer analyzer = customAnalyzer;
                    if (analyzer == null)
                    {
                        analyzer = TRUE.Equals(toLowerCase) ? LuceneDataSource.LOWER_CASE_WHITESPACE_ANALYZER : LuceneDataSource.WhitespaceAnalyzer;
                    }
                    result = new CustomType(analyzer, toLowerCase, similarity);
                }
                else
                {
                    throw new System.ArgumentException("The given type was not recognized: " + type + ". Known types are 'fulltext' and 'exact'");
                }
            }
            else
            {
                // In the custom case we default to true
                bool toLowerCase = !FALSE.Equals(toLowerCaseUnbiased);

                // Use custom analyzer
                if (customAnalyzer == null)
                {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                    throw new System.ArgumentException("No 'type' was given (which can point out " + "built-in analyzers, such as 'exact' and 'fulltext')" + " and no 'analyzer' was given either (which can point out a custom " + typeof(Analyzer).FullName + " to use)");
                }
                result = new CustomType(customAnalyzer, toLowerCase, similarity);
            }
            return(result);
        }