Esempio 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);
        }
Esempio n. 2
0
        public virtual Filter GetFilter(XmlElement e)
        {
            BooleanFilter bf = new BooleanFilter();
            XmlNodeList   nl = e.ChildNodes;

            for (int i = 0; i < nl.Count; i++)
            {
                XmlNode node = nl.Item(i);
                if (node.LocalName.Equals("Clause", StringComparison.Ordinal))
                {
                    XmlElement clauseElem = (XmlElement)node;
                    Occur      occurs     = BooleanQueryBuilder.GetOccursValue(clauseElem);

                    XmlElement clauseFilter = DOMUtils.GetFirstChildOrFail(clauseElem);
                    Filter     f            = factory.GetFilter(clauseFilter);
                    bf.Add(new FilterClause(f, occurs));
                }
            }

            return(bf);
        }