本文整理汇总了C#中Lucene.Net.Search.Query.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Query.GetType方法的具体用法?C# Query.GetType怎么用?C# Query.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.Query
的用法示例。
在下文中一共展示了Query.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitQuery
public virtual Query VisitQuery(Query qry)
{
if (qry == null) return null;
if (qry is TermQuery)
{
return VisitTermQuery((TermQuery)qry);
}
//else if (qry is MultiTermQuery)
//{
// -> abstract
//}
else if (qry is BooleanQuery)
{
return VisitBooleanQuery((BooleanQuery)qry);
}
else if (qry is WildcardQuery)
{
return VisitWildcardQuery((WildcardQuery)qry);
}
else if (qry is PhraseQuery)
{
return VisitPhraseQuery((PhraseQuery)qry);
}
else if (qry is PrefixQuery)
{
return VisitPrefixQuery((PrefixQuery)qry);
}
else if (qry is MultiPhraseQuery)
{
return VisitMultiPhraseQuery((MultiPhraseQuery)qry);
}
else if (qry is FuzzyQuery)
{
return VisitFuzzyQuery((FuzzyQuery)qry);
}
else if (qry is TermRangeQuery)
{
return VisitTermRangeQuery((TermRangeQuery)qry);
}
else if (qry.GetType().IsGenericType && qry.GetType().GetGenericTypeDefinition() == typeof(NumericRangeQuery<>))
{
return VisitNumericRangeQuery((MultiTermQuery)qry);
}
//else if (qry is SpanQuery)
//{
// -> abstract
//}
Logging.Log.Warn(string.Format("Unknown query type: '{0}'", qry.GetType().FullName));
return qry;
}
示例2: Visit
private static void Visit(Query query, AzureQueryLogger.IndentedTextWriter writer)
{
writer.WriteLine("Query Type: {0}", (object)query.GetType().FullName);
++writer.Indent;
writer.WriteLine("Boost: {0}", (object)query.Boost);
if (query is BooleanQuery)
AzureQueryLogger.VisitQuery((BooleanQuery)query, writer);
if (query is TermQuery)
AzureQueryLogger.VisitQuery((TermQuery)query, writer);
if (query is PhraseQuery)
AzureQueryLogger.VisitQuery((PhraseQuery)query, writer);
if (query is MultiTermQuery)
AzureQueryLogger.VisitQuery((MultiTermQuery)query, writer);
if (query is MultiPhraseQuery)
AzureQueryLogger.VisitQuery((MultiPhraseQuery)query, writer);
if (query is MatchAllDocsQuery)
AzureQueryLogger.VisitQuery((MatchAllDocsQuery)query, writer);
if (query is FieldScoreQuery)
AzureQueryLogger.VisitQuery((FieldScoreQuery)query, writer);
if (query is ValueSourceQuery)
AzureQueryLogger.VisitQuery((ValueSourceQuery)query, writer);
if (query is CustomScoreQuery)
AzureQueryLogger.VisitQuery((CustomScoreQuery)query, writer);
if (query is FilteredQuery)
AzureQueryLogger.VisitQuery((FilteredQuery)query, writer);
if (query is DisjunctionMaxQuery)
AzureQueryLogger.VisitQuery((DisjunctionMaxQuery)query, writer);
if (query is ConstantScoreQuery)
AzureQueryLogger.VisitQuery((ConstantScoreQuery)query, writer);
if (query is SpanQuery)
AzureQueryLogger.VisitQuery((SpanQuery)query, writer);
--writer.Indent;
}
示例3: Visit
public virtual Query Visit(Query q)
{
var booleanq = q as BooleanQuery; if (booleanq != null) return VisitBooleanQuery(booleanq);
//var boostingq = q as BoostingQuery; if (boostingq != null) return VisitBoostingQuery(boostingq);
var constantScoreq = q as ConstantScoreQuery; if (constantScoreq != null) return VisitConstantScoreQuery(constantScoreq);
var constantScoreRangeq = q as ConstantScoreRangeQuery; if (constantScoreRangeq != null) return VisitConstantScoreRangeQuery(constantScoreRangeq);
var customScoreq = q as CustomScoreQuery; if (customScoreq != null) return VisitCustomScoreQuery(customScoreq);
var disjunctionMaxq = q as DisjunctionMaxQuery; if (disjunctionMaxq != null) return VisitDisjunctionMaxQuery(disjunctionMaxq);
var filteredq = q as FilteredQuery; if (filteredq != null) return VisitFilteredQuery(filteredq);
//var fuzzyLikeThisq = q as FuzzyLikeThisQuery; if (fuzzyLikeThisq != null) return VisitFuzzyLikeThisQuery(fuzzyLikeThisq);
var matchAllDocsq = q as MatchAllDocsQuery; if (matchAllDocsq != null) return VisitMatchAllDocsQuery(matchAllDocsq);
//var moreLikeThisq = q as MoreLikeThisQuery; if (moreLikeThisq != null) return VisitMoreLikeThisQuery(moreLikeThisq);
var multiPhraseq = q as MultiPhraseQuery; if (multiPhraseq != null) return VisitMultiPhraseQuery(multiPhraseq);
var fuzzyq = q as FuzzyQuery; if (fuzzyq != null) return VisitFuzzyQuery(fuzzyq);
var wildcardq = q as WildcardQuery; if (wildcardq != null) return VisitWildcardQuery(wildcardq);
var phraseq = q as PhraseQuery; if (phraseq != null) return VisitPhraseQuery(phraseq);
var prefixq = q as PrefixQuery; if (prefixq != null) return VisitPrefixQuery(prefixq);
var rangeq = q as RangeQuery; if (rangeq != null) return VisitRangeQuery(rangeq);
var spanFirstq = q as SpanFirstQuery; if (spanFirstq != null) return VisitSpanFirstQuery(spanFirstq);
var spanNearq = q as SpanNearQuery; if (spanNearq != null) return VisitSpanNearQuery(spanNearq);
var spanNotq = q as SpanNotQuery; if (spanNotq != null) return VisitSpanNotQuery(spanNotq);
var spanOrq = q as SpanOrQuery; if (spanOrq != null) return VisitSpanOrQuery(spanOrq);
var spanTermq = q as SpanTermQuery; if (spanTermq != null) return VisitSpanTermQuery(spanTermq);
var termq = q as TermQuery; if (termq != null) return VisitTermQuery(termq);
var valueSourceq = q as ValueSourceQuery; if (valueSourceq != null) return VisitValueSourceQuery(valueSourceq);
var fieldScoreq = q as FieldScoreQuery; if (fieldScoreq != null) return VisitFieldScoreQuery(fieldScoreq);
// <V2.9.2>
var termRangeq = q as TermRangeQuery; if (termRangeq != null) return VisitTermRangeQuery(termRangeq);
var numericRangeq = q as NumericRangeQuery; if (numericRangeq != null) return VisitNumericRangeQuery(numericRangeq);
// </V2.9.2>
throw new NotImplementedException("Unknown query type: " + q.GetType().FullName);
}
示例4: Translate
private SectionSearchQueryPlan Translate(Query query)
{
if (query != null)
{
if (query is TermQuery)
{
return TranslateTermQuery((TermQuery)query);
}
else if (query is PhraseQuery)
{
return TranslatePhraseQuery((PhraseQuery)query);
}
else if (query is BooleanQuery)
{
return TranslateBooleanQuery((BooleanQuery)query);
}
else if (query is MetaDataQuery)
{
MetaDataQuery mquery = (MetaDataQuery)query;
IMetaDataCache cache = (_cacheProvider != null ? _cacheProvider.Get(mquery.Term) : null);
if (cache != null)
{
return ((MetaDataQuery)query).GetPlan(cache);
}
else
{
return ((MetaDataQuery)query).GetPlan(_reader);
}
}
else
{
throw new TranslationException("unable to translate Query class: " + query.GetType().Name);
}
}
return null;
}
示例5: ResolveQuery
private Lucene.Net.Search.Query ResolveQuery(Query query)
{
var type = query.GetType();
if (type == typeof(BooleanQuery))
return GetBooleanQuery((BooleanQuery)query);
if (type == typeof(ContainsQuery))
return GetContainsQuery((ContainsQuery)query);
if (type == typeof(NotQuery))
return GetNotQuery((NotQuery)query);
if (type == typeof(TermQuery))
return GetTermQuery((TermQuery)query);
if (type == typeof(RangeQuery))
return GetRangeQuery((RangeQuery)query);
if (type == typeof(WildCardQuery))
return GetWildCardQuery((WildCardQuery)query);
if (type == typeof(DateRangeQuery))
return GetDateRangeQuery((DateRangeQuery) query);
throw new NotImplementedException("Query Type " + type.Name + " has not been translated in " + GetType().Name);
}