Пример #1
0
        /// <summary>
        /// Create a new <see cref="SpanMultiTermQueryWrapper{Q}"/>.
        /// </summary>
        /// <param name="query"> Query to wrap.
        /// <para/>
        /// NOTE: This will set <see cref="MultiTermQuery.MultiTermRewriteMethod"/>
        /// on the wrapped <paramref name="query"/>, changing its rewrite method to a suitable one for spans.
        /// Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
        /// throw <see cref="NotSupportedException"/> on rewriting this query! </param>
        public SpanMultiTermQueryWrapper(Q query)
        {
            this.m_query = query;

            MultiTermQuery.RewriteMethod method = this.m_query.MultiTermRewriteMethod;
            if (method is ITopTermsRewrite topTermsRewrite)
            {
                MultiTermRewriteMethod = new TopTermsSpanBooleanQueryRewrite(topTermsRewrite.Count);
            }
            else
            {
                MultiTermRewriteMethod = SCORING_SPAN_QUERY_REWRITE;
            }
        }
Пример #2
0
        /// <summary>
        /// Create a new SpanMultiTermQueryWrapper.
        /// </summary>
        /// <param name="query"> Query to wrap.
        /// <p>
        /// NOTE: this will call <seealso cref="MultiTermQuery#setRewriteMethod(MultiTermQuery.RewriteMethod)"/>
        /// on the wrapped <code>query</code>, changing its rewrite method to a suitable one for spans.
        /// Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will
        /// throw <seealso cref="UnsupportedOperationException"/> on rewriting this query! </param>
        public SpanMultiTermQueryWrapper(Q query_)
        {
            this.query = query_;

            MultiTermQuery.RewriteMethod method = query.GetRewriteMethod();
            if (method is ITopTermsRewrite)
            {
                int pqsize = ((ITopTermsRewrite)method).Size;
                RewriteMethod = new TopTermsSpanBooleanQueryRewrite(pqsize);
            }
            else
            {
                RewriteMethod = SCORING_SPAN_QUERY_REWRITE;
            }
        }
Пример #3
0
            public override bool Equals(object obj)
            {
                if (this == obj)
                {
                    return(true);
                }
                if (obj == null)
                {
                    return(false);
                }
                if (this.GetType() != obj.GetType())
                {
                    return(false);
                }
                TopTermsSpanBooleanQueryRewrite other = (TopTermsSpanBooleanQueryRewrite)obj;

                return(@delegate.Equals(other.@delegate));
            }
Пример #4
0
 public TopTermsRewriteAnonymousInnerClassHelper(TopTermsSpanBooleanQueryRewrite outerInstance, int size)
     : base(size)
 {
     this.OuterInstance = outerInstance;
 }