Пример #1
0
        /// <summary>
        /// Builds a new RegexpQuery instance
        /// </summary>
        /// <param name="regexp">Regexp term</param>
        /// <returns>new RegexpQuery instance</returns>
        protected internal virtual Query NewRegexpQuery(Term regexp)
        {
            RegexpQuery query = new RegexpQuery(regexp);

            query.SetRewriteMethod(MultiTermRewriteMethod);
            return(query);
        }
Пример #2
0
        public virtual Query Build(IQueryNode queryNode)
        {
            RegexpQueryNode regexpNode = (RegexpQueryNode)queryNode;

            RegexpQuery q = new RegexpQuery(new Term(regexpNode.GetFieldAsString(),
                                                     regexpNode.TextToBytesRef()));

            MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod)queryNode
                                                  .GetTag(MultiTermRewriteMethodProcessor.TAG_ID);
            if (method != null)
            {
                q.SetRewriteMethod(method);
            }

            return(q);
        }