Exemplo n.º 1
0
        /// <summary>
        /// (non-Javadoc)
        /// @see org.apache.lucene.xmlparser.QueryObjectBuilder#process(org.w3c.dom.Element)
        /// </summary>
        public virtual Query GetQuery(XmlElement e)
        {
            XmlElement filterElement = DOMUtils.GetChildByTagOrFail(e, "Filter");

            filterElement = DOMUtils.GetFirstChildOrFail(filterElement);
            Filter f = filterFactory.GetFilter(filterElement);

            XmlElement queryElement = DOMUtils.GetChildByTagOrFail(e, "Query");

            queryElement = DOMUtils.GetFirstChildOrFail(queryElement);
            Query q = queryFactory.GetQuery(queryElement);

            FilteredQuery fq = new FilteredQuery(q, f);

            fq.Boost = DOMUtils.GetAttribute(e, "boost", 1.0f);
            return(fq);
        }
Exemplo n.º 2
0
        public override SpanQuery GetSpanQuery(XmlElement e)
        {
            XmlElement includeElem = DOMUtils.GetChildByTagOrFail(e, "Include");

            includeElem = DOMUtils.GetFirstChildOrFail(includeElem);

            XmlElement excludeElem = DOMUtils.GetChildByTagOrFail(e, "Exclude");

            excludeElem = DOMUtils.GetFirstChildOrFail(excludeElem);

            SpanQuery include = factory.GetSpanQuery(includeElem);
            SpanQuery exclude = factory.GetSpanQuery(excludeElem);

            SpanNotQuery snq = new SpanNotQuery(include, exclude);

            snq.Boost = DOMUtils.GetAttribute(e, "boost", 1.0f);
            return(snq);
        }
Exemplo n.º 3
0
        public virtual Query GetQuery(XmlElement e)
        {
            XmlElement mainQueryElem = DOMUtils.GetChildByTagOrFail(e, "Query");

            mainQueryElem = DOMUtils.GetFirstChildOrFail(mainQueryElem);
            Query mainQuery = factory.GetQuery(mainQueryElem);

            XmlElement boostQueryElem = DOMUtils.GetChildByTagOrFail(e, "BoostQuery");
            float      boost          = DOMUtils.GetAttribute(boostQueryElem, "boost", DEFAULT_BOOST);

            boostQueryElem = DOMUtils.GetFirstChildOrFail(boostQueryElem);
            Query boostQuery = factory.GetQuery(boostQueryElem);

            BoostingQuery bq = new BoostingQuery(mainQuery, boostQuery, boost);

            bq.Boost = DOMUtils.GetAttribute(e, "boost", 1.0f);
            return(bq);
        }