FileDocCategorySizeDatePackage
SpanNearBuilder.javaAPI DocApache Lucene 1.91284Mon Feb 27 11:12:20 GMT 2006org.apache.lucene.xmlparser.builders

SpanNearBuilder

public class SpanNearBuilder extends SpanBuilderBase

Fields Summary
SpanQueryBuilder
factory
Constructors Summary
public SpanNearBuilder(SpanQueryBuilder factory)

		this.factory=factory;
	
Methods Summary
public org.apache.lucene.search.spans.SpanQuerygetSpanQuery(org.w3c.dom.Element e)

		String slopString=e.getAttribute("slop");
		if((slopString==null)||(slopString.length()==0))
		{
			throw new ParserException("SpanTermQuery missing slop property ");			
		}
		int slop=Integer.parseInt(slopString);
		boolean inOrder=DOMUtils.getAttribute(e,"inOrder",false);
		ArrayList spans=new ArrayList();
		for (Node kid = e.getFirstChild(); kid != null; kid = kid.getNextSibling())
		{
				if (kid.getNodeType() == Node.ELEMENT_NODE) 
				{
					spans.add(factory.getSpanQuery((Element) kid));
				}
		}
		SpanQuery[] spanQueries=(SpanQuery[]) spans.toArray(new SpanQuery[spans.size()]);
		SpanNearQuery snq=new SpanNearQuery(spanQueries,slop,inOrder);
		return snq;