本文整理汇总了C#中Lucene.Net.Search.Spans.SpanQuery类的典型用法代码示例。如果您正苦于以下问题:C# SpanQuery类的具体用法?C# SpanQuery怎么用?C# SpanQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpanQuery类属于Lucene.Net.Search.Spans命名空间,在下文中一共展示了SpanQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MultiSpansWrapper
private MultiSpansWrapper(IList<AtomicReaderContext> leaves, SpanQuery query, IDictionary<Term, TermContext> termContexts)
{
this.Query = query;
this.Leaves = leaves;
this.NumLeaves = leaves.Count;
this.TermContexts = termContexts;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:MultiSpansWrapper.cs
示例2: VisitQuery
private static void VisitQuery(SpanQuery query, AzureQueryLogger.IndentedTextWriter writer)
{
writer.WriteLine("Field: {0}", (object)query.Field);
if (query is FieldMaskingSpanQuery)
AzureQueryLogger.VisitQuery((FieldMaskingSpanQuery)query, writer);
if (query is SpanFirstQuery)
AzureQueryLogger.VisitQuery((SpanFirstQuery)query, writer);
if (query is SpanNearQuery)
AzureQueryLogger.VisitQuery((SpanNearQuery)query, writer);
if (query is SpanNotQuery)
AzureQueryLogger.VisitQuery((SpanNotQuery)query, writer);
if (query is SpanOrQuery)
AzureQueryLogger.VisitQuery((SpanOrQuery)query, writer);
if (query is SpanRegexQuery)
AzureQueryLogger.VisitQuery((SpanRegexQuery)query, writer);
if (query is SpanTermQuery)
AzureQueryLogger.VisitQuery((SpanTermQuery)query, writer);
if (query is PayloadNearQuery)
AzureQueryLogger.VisitQuery((PayloadNearQuery)query, writer);
if (query is PayloadTermQuery)
AzureQueryLogger.VisitQuery((PayloadTermQuery)query, writer);
if (query is SpanWildcardQuery)
AzureQueryLogger.VisitQuery((SpanWildcardQuery)query, writer);
if (query is SpanLastQuery)
AzureQueryLogger.VisitQuery((SpanLastQuery)query, writer);
if (!(query is SpanFuzzyQuery))
return;
AzureQueryLogger.VisitQuery((SpanFuzzyQuery)query, writer);
}
开发者ID:jscott1277,项目名称:SitecoreAzureSearchProvider,代码行数:29,代码来源:AzureQueryLogger.cs
示例3: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
this.terms = query.GetTerms();
idf = this.query.GetSimilarity(searcher).Idf(terms, searcher);
}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:8,代码来源:SpanWeight.cs
示例4: SpanNotQuery
/// <summary>Construct a SpanNotQuery matching spans from <c>include</c> which
/// have no overlap with spans from <c>exclude</c>.
/// </summary>
public SpanNotQuery(SpanQuery include, SpanQuery exclude)
{
this.include = include;
this.exclude = exclude;
if (!include.GetField().Equals(exclude.GetField()))
throw new System.ArgumentException("Clauses must have same field.");
}
开发者ID:sinsay,项目名称:SSE,代码行数:11,代码来源:SpanNotQuery.cs
示例5: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
terms = new Support.Set<Lucene.Net.Index.Term>();
query.ExtractTerms(terms);
idfExp = similarity.idfExplain(terms.ToArray(), searcher);
idf = idfExp.GetIdf();
}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:9,代码来源:SpanWeight.cs
示例6: SpanPayloadCheckQuery
///
/// <param name="match"> The underlying <seealso cref="Lucene.Net.Search.Spans.SpanQuery"/> to check </param>
/// <param name="payloadToMatch"> The <seealso cref="java.util.Collection"/> of payloads to match </param>
public SpanPayloadCheckQuery(SpanQuery match, ICollection<byte[]> payloadToMatch)
: base(match)
{
if (match is SpanNearQuery)
{
throw new System.ArgumentException("SpanNearQuery not allowed");
}
this.PayloadToMatch = payloadToMatch;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:12,代码来源:SpanPayloadCheckQuery.cs
示例7: TestSpanNearInOrderVersusOutOfOrder
public virtual void TestSpanNearInOrderVersusOutOfOrder()
{
Term t1 = RandomTerm();
Term t2 = RandomTerm();
SpanQuery[] subquery = new SpanQuery[] { new SpanTermQuery(t1), new SpanTermQuery(t2) };
SpanNearQuery q1 = new SpanNearQuery(subquery, 3, true);
SpanNearQuery q2 = new SpanNearQuery(subquery, 3, false);
AssertSubsetOf(q1, q2);
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:TestSpanSearchEquivalence.cs
示例8: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
terms = new System.Collections.Hashtable();
query.ExtractTerms(terms);
idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
idf = idfExp.GetIdf();
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:9,代码来源:SpanWeight.cs
示例9: TestSpanNearVersusBooleanAnd
public virtual void TestSpanNearVersusBooleanAnd()
{
Term t1 = RandomTerm();
Term t2 = RandomTerm();
SpanQuery[] subquery = new SpanQuery[] { new SpanTermQuery(t1), new SpanTermQuery(t2) };
SpanNearQuery q1 = new SpanNearQuery(subquery, int.MaxValue, false);
BooleanQuery q2 = new BooleanQuery();
q2.Add(new TermQuery(t1), Occur.MUST);
q2.Add(new TermQuery(t2), Occur.MUST);
AssertSameSet(q1, q2);
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:TestSpanSearchEquivalence.cs
示例10: TestSpanNearVersusPhrase
public virtual void TestSpanNearVersusPhrase()
{
Term t1 = RandomTerm();
Term t2 = RandomTerm();
SpanQuery[] subquery = new SpanQuery[] { new SpanTermQuery(t1), new SpanTermQuery(t2) };
SpanNearQuery q1 = new SpanNearQuery(subquery, 0, true);
PhraseQuery q2 = new PhraseQuery();
q2.Add(t1);
q2.Add(t2);
AssertSameSet(q1, q2);
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:TestSpanSearchEquivalence.cs
示例11: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.internalQuery = query;
terms = Lucene.Net.Support.Compatibility.SetFactory.CreateHashSet<Term>();
query.ExtractTerms(terms);
idfExp = similarity.IdfExplain(terms, searcher);
idf = idfExp.Idf;
}
开发者ID:Nangal,项目名称:lucene.net,代码行数:11,代码来源:SpanWeight.cs
示例12: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
terms = new System.Collections.Hashtable();
query.ExtractTerms(terms);
System.Collections.ArrayList tmp = new System.Collections.ArrayList(terms.Values);
idf = this.query.GetSimilarity(searcher).Idf(tmp, searcher);
}
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:11,代码来源:SpanWeight.cs
示例13: SpanNotQuery
/// <summary>
/// Construct a SpanNotQuery matching spans from <code>include</code> which
/// have no overlap with spans from <code>exclude</code> within
/// <code>pre</code> tokens before or <code>post</code> tokens of <code>include</code>.
/// </summary>
public SpanNotQuery(SpanQuery include, SpanQuery exclude, int pre, int post)
{
this.include = include;
this.exclude = exclude;
this.Pre = (pre >= 0) ? pre : 0;
this.Post = (post >= 0) ? post : 0;
if (include.Field != null && exclude.Field != null && !include.Field.Equals(exclude.Field))
{
throw new System.ArgumentException("Clauses must have same field.");
}
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:17,代码来源:SpanNotQuery.cs
示例14: Clone
public override System.Object Clone()
{
int sz = clauses.Count;
SpanQuery[] newClauses = new SpanQuery[sz];
for (int i = 0; i < sz; i++)
{
SpanQuery clause = (SpanQuery) clauses[i];
newClauses[i] = (SpanQuery) clause.Clone();
}
SpanOrQuery soq = new SpanOrQuery(newClauses);
soq.SetBoost(GetBoost());
return soq;
}
开发者ID:sinsay,项目名称:SSE,代码行数:14,代码来源:SpanOrQuery.cs
示例15: Wrap
public static Spans Wrap(IndexReaderContext topLevelReaderContext, SpanQuery query)
{
IDictionary<Term, TermContext> termContexts = new Dictionary<Term, TermContext>();
SortedSet<Term> terms = new SortedSet<Term>();
query.ExtractTerms(terms);
foreach (Term term in terms)
{
termContexts[term] = TermContext.Build(topLevelReaderContext, term);
}
IList<AtomicReaderContext> leaves = topLevelReaderContext.Leaves();
if (leaves.Count == 1)
{
AtomicReaderContext ctx = leaves[0];
return query.GetSpans(ctx, ((AtomicReader)ctx.Reader()).LiveDocs, termContexts);
}
return new MultiSpansWrapper(leaves, query, termContexts);
}
开发者ID:joyanta,项目名称:lucene.net,代码行数:17,代码来源:MultiSpansWrapper.cs
示例16: Build
public virtual Query Build(IQueryNode node)
{
// validates node
BooleanQueryNode booleanNode = (BooleanQueryNode)node;
IList<IQueryNode> children = booleanNode.GetChildren();
SpanQuery[]
spanQueries = new SpanQuery[children.size()];
int i = 0;
foreach (IQueryNode child in children)
{
spanQueries[i++] = (SpanQuery)child
.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
}
return new SpanOrQuery(spanQueries);
}
开发者ID:apache,项目名称:lucenenet,代码行数:18,代码来源:SpanOrQueryNodeBuilder.cs
示例17: SpanOrQuery
/// <summary>Construct a SpanOrQuery merging the provided clauses. </summary>
public SpanOrQuery(SpanQuery[] clauses)
{
// copy clauses array into an ArrayList
this.clauses = new System.Collections.ArrayList(clauses.Length);
for (int i = 0; i < clauses.Length; i++)
{
SpanQuery clause = clauses[i];
if (i == 0)
{
// check field
field = clause.GetField();
}
else if (!clause.GetField().Equals(field))
{
throw new System.ArgumentException("Clauses must have same field.");
}
this.clauses.Add(clause);
}
}
开发者ID:karino2,项目名称:wikipediaconv,代码行数:20,代码来源:SpanOrQuery.cs
示例18: SpanNearQuery
public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder, bool collectPayloads)
{
// copy clauses array into an ArrayList
this.clauses = new List<SpanQuery>(clauses.Length);
for (int i = 0; i < clauses.Length; i++)
{
SpanQuery clause = clauses[i];
if (field == null) // check field
{
field = clause.Field;
}
else if (clause.Field != null && !clause.Field.Equals(field))
{
throw new System.ArgumentException("Clauses must have same field.");
}
this.clauses.Add(clause);
}
this.CollectPayloads = collectPayloads;
this.slop = slop;
this.inOrder = inOrder;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:21,代码来源:SpanNearQuery.cs
示例19: SpanWeight
public SpanWeight(SpanQuery query, IndexSearcher searcher)
{
this.Similarity = searcher.Similarity;
this.query = query;
TermContexts = new Dictionary<Term, TermContext>();
SortedSet<Term> terms = new SortedSet<Term>();
query.ExtractTerms(terms);
IndexReaderContext context = searcher.TopReaderContext;
TermStatistics[] termStats = new TermStatistics[terms.Count];
int i = 0;
foreach (Term term in terms)
{
TermContext state = TermContext.Build(context, term);
termStats[i] = searcher.TermStatistics(term, state);
TermContexts[term] = state;
i++;
}
string field = query.Field;
if (field != null)
{
Stats = Similarity.ComputeWeight(query.Boost, searcher.CollectionStatistics(query.Field), termStats);
}
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:24,代码来源:SpanWeight.cs
示例20: SpanLastQuery
public SpanLastQuery(SpanQuery match, Analyzer analyzer)
{
this.match = match;
this.analyzer = analyzer;
}
开发者ID:jscott1277,项目名称:SitecoreAzureSearchProvider,代码行数:5,代码来源:SpalnLastQuery.cs
注:本文中的Lucene.Net.Search.Spans.SpanQuery类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论