FileDocCategorySizeDatePackage
FilteredQueryBuilder.javaAPI DocApache Lucene 1.91805Mon Feb 27 11:12:20 GMT 2006org.apache.lucene.xmlparser

FilteredQueryBuilder

public class FilteredQueryBuilder extends Object implements QueryBuilder
author
maharwood

Fields Summary
private FilterBuilder
filterFactory
private QueryBuilder
queryFactory
Constructors Summary
public FilteredQueryBuilder(FilterBuilder filterFactory, QueryBuilder queryFactory)

		this.filterFactory=filterFactory;
		this.queryFactory=queryFactory;
		
	
Methods Summary
public org.apache.lucene.search.QuerygetQuery(org.w3c.dom.Element e)

		Element filterElement=DOMUtils.getChildByTagName(e,"Filter");
		if(filterElement==null)
		{
			throw new ParserException("FilteredQuery missing \"Filter\" child element");
		}
		filterElement=DOMUtils.getFirstChildElement(filterElement);
		Filter f=null;
		if(filterElement!=null)
		{
			f=filterFactory.getFilter(filterElement);
		}
		else
		{
			throw new ParserException("FilteredQuery \"Filter\" element missing child query element ");
		}
		
		
		Element queryElement=DOMUtils.getChildByTagName(e,"Query");
		if(queryElement==null)
		{
			throw new ParserException("FilteredQuery missing \"Query\" child element");
		}
		queryElement=DOMUtils.getFirstChildElement(queryElement);
		Query q=null;
		if(queryElement!=null)
		{
			q=queryFactory.getQuery(queryElement);
		}
		else
		{
			throw new ParserException("FilteredQuery \"Query\" element missing child query element ");
		}

		
		FilteredQuery fq = new FilteredQuery(q,f);
		fq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
		return fq;