lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r712922 [8/9] - in /lucene/java/trunk: contrib/analyzers/src/java/org/apache/lucene/analysis/el/ contrib/analyzers/src/java/org/apache/lucene/analysis/fr/ contrib/analyzers/src/java/org/apache/lucene/analysis/miscellaneous/ contrib/analyzer...
Date Tue, 11 Nov 2008 02:35:52 GMT
Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/ConstantScoreQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/DuplicateFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/DuplicateFilterBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/DuplicateFilterBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/DuplicateFilterBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,73 +1,73 @@
-/*
- * Created on 25-Jan-2006
- */
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanFilter;
-import org.apache.lucene.search.DuplicateFilter;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.FilterClause;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.FilterBuilder;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class DuplicateFilterBuilder implements FilterBuilder {
-	
-
-	public Filter getFilter(Element e) throws ParserException {
-        String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
-		DuplicateFilter df=new DuplicateFilter(fieldName);
-		String keepMode=DOMUtils.getAttribute(e,"keepMode","first");
-		if(keepMode.equalsIgnoreCase("first"))
-		{
-			df.setKeepMode(DuplicateFilter.KM_USE_FIRST_OCCURRENCE);
-		}
-		else
-			if(keepMode.equalsIgnoreCase("last"))
-			{
-				df.setKeepMode(DuplicateFilter.KM_USE_LAST_OCCURRENCE);
-			}
-			else
-			{
-				throw new ParserException("Illegal keepMode attribute in DuplicateFilter:"+keepMode);
-			}
-		String processingMode=DOMUtils.getAttribute(e,"processingMode","full");
-		if(processingMode.equalsIgnoreCase("full"))
-		{
-			df.setProcessingMode(DuplicateFilter.PM_FULL_VALIDATION);
-		}
-		else
-			if(processingMode.equalsIgnoreCase("fast"))
-			{
-				df.setProcessingMode(DuplicateFilter.PM_FAST_INVALIDATION);
-			}
-			else
-			{
-				throw new ParserException("Illegal processingMode attribute in DuplicateFilter:"+processingMode);
-			}
-					
-		return df;
-	}
-
-}
+/*
+ * Created on 25-Jan-2006
+ */
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanFilter;
+import org.apache.lucene.search.DuplicateFilter;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.FilterClause;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.FilterBuilder;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class DuplicateFilterBuilder implements FilterBuilder {
+	
+
+	public Filter getFilter(Element e) throws ParserException {
+        String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
+		DuplicateFilter df=new DuplicateFilter(fieldName);
+		String keepMode=DOMUtils.getAttribute(e,"keepMode","first");
+		if(keepMode.equalsIgnoreCase("first"))
+		{
+			df.setKeepMode(DuplicateFilter.KM_USE_FIRST_OCCURRENCE);
+		}
+		else
+			if(keepMode.equalsIgnoreCase("last"))
+			{
+				df.setKeepMode(DuplicateFilter.KM_USE_LAST_OCCURRENCE);
+			}
+			else
+			{
+				throw new ParserException("Illegal keepMode attribute in DuplicateFilter:"+keepMode);
+			}
+		String processingMode=DOMUtils.getAttribute(e,"processingMode","full");
+		if(processingMode.equalsIgnoreCase("full"))
+		{
+			df.setProcessingMode(DuplicateFilter.PM_FULL_VALIDATION);
+		}
+		else
+			if(processingMode.equalsIgnoreCase("fast"))
+			{
+				df.setProcessingMode(DuplicateFilter.PM_FAST_INVALIDATION);
+			}
+			else
+			{
+				throw new ParserException("Illegal processingMode attribute in DuplicateFilter:"+processingMode);
+			}
+					
+		return df;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/DuplicateFilterBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FilteredQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FilteredQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FilteredQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FilteredQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,61 +1,61 @@
-/*
- * Created on 25-Jan-2006
- */
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.FilteredQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.FilterBuilder;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class FilteredQueryBuilder implements QueryBuilder {
-	
-	private FilterBuilder filterFactory;
-	private QueryBuilder queryFactory;
-
-	public FilteredQueryBuilder(FilterBuilder filterFactory, QueryBuilder queryFactory)
-	{
-		this.filterFactory=filterFactory;
-		this.queryFactory=queryFactory;
-		
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.lucene.xmlparser.QueryObjectBuilder#process(org.w3c.dom.Element)
-	 */
-	public Query getQuery(Element e) throws ParserException {	
- 	    Element filterElement=DOMUtils.getChildByTagOrFail(e,"Filter");
- 	    filterElement=DOMUtils.getFirstChildOrFail(filterElement);
- 	    Filter f=filterFactory.getFilter(filterElement);
- 
- 	    Element queryElement=DOMUtils.getChildByTagOrFail(e,"Query");
- 	    queryElement=DOMUtils.getFirstChildOrFail(queryElement);
- 	    Query q=queryFactory.getQuery(queryElement);
- 	    
- 	    FilteredQuery fq = new FilteredQuery(q,f);
- 	    fq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
- 	    return fq;		
-	}
-
-}
+/*
+ * Created on 25-Jan-2006
+ */
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.FilteredQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.FilterBuilder;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class FilteredQueryBuilder implements QueryBuilder {
+	
+	private FilterBuilder filterFactory;
+	private QueryBuilder queryFactory;
+
+	public FilteredQueryBuilder(FilterBuilder filterFactory, QueryBuilder queryFactory)
+	{
+		this.filterFactory=filterFactory;
+		this.queryFactory=queryFactory;
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.lucene.xmlparser.QueryObjectBuilder#process(org.w3c.dom.Element)
+	 */
+	public Query getQuery(Element e) throws ParserException {	
+ 	    Element filterElement=DOMUtils.getChildByTagOrFail(e,"Filter");
+ 	    filterElement=DOMUtils.getFirstChildOrFail(filterElement);
+ 	    Filter f=filterFactory.getFilter(filterElement);
+ 
+ 	    Element queryElement=DOMUtils.getChildByTagOrFail(e,"Query");
+ 	    queryElement=DOMUtils.getFirstChildOrFail(queryElement);
+ 	    Query q=queryFactory.getQuery(queryElement);
+ 	    
+ 	    FilteredQuery fq = new FilteredQuery(q,f);
+ 	    fq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+ 	    return fq;		
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FilteredQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FuzzyLikeThisQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FuzzyLikeThisQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FuzzyLikeThisQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FuzzyLikeThisQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,62 +1,62 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.search.FuzzyLikeThisQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class FuzzyLikeThisQueryBuilder implements QueryBuilder
-{
-	int defaultMaxNumTerms=50;
-	float defaultMinSimilarity=0.5f;
-	int defaultPrefixLength=1;
-	boolean defaultIgnoreTF=false;
-	private Analyzer analyzer;
-	
-	public FuzzyLikeThisQueryBuilder(Analyzer analyzer)
-	{
-		this.analyzer=analyzer;
-	}
-
-	public Query getQuery(Element e) throws ParserException
-	{
-		NodeList nl = e.getElementsByTagName("Field");
-		int maxNumTerms=DOMUtils.getAttribute(e,"maxNumTerms",defaultMaxNumTerms);
-		FuzzyLikeThisQuery fbq=new FuzzyLikeThisQuery(maxNumTerms,analyzer);
-		fbq.setIgnoreTF(DOMUtils.getAttribute(e,"ignoreTF",defaultIgnoreTF));
-		for(int i=0;i<nl.getLength();i++)
-		{
-			Element fieldElem=(Element) nl.item(i);
-			float minSimilarity=DOMUtils.getAttribute(fieldElem,"minSimilarity",defaultMinSimilarity);
-			int prefixLength=DOMUtils.getAttribute(fieldElem,"prefixLength",defaultPrefixLength);
-			String fieldName=DOMUtils.getAttributeWithInheritance(fieldElem,"fieldName");
-			
-			String value=DOMUtils.getText(fieldElem);
-			fbq.addTerms(value,fieldName,minSimilarity,prefixLength);
-		}
-		fbq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-
-		return fbq;
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.search.FuzzyLikeThisQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class FuzzyLikeThisQueryBuilder implements QueryBuilder
+{
+	int defaultMaxNumTerms=50;
+	float defaultMinSimilarity=0.5f;
+	int defaultPrefixLength=1;
+	boolean defaultIgnoreTF=false;
+	private Analyzer analyzer;
+	
+	public FuzzyLikeThisQueryBuilder(Analyzer analyzer)
+	{
+		this.analyzer=analyzer;
+	}
+
+	public Query getQuery(Element e) throws ParserException
+	{
+		NodeList nl = e.getElementsByTagName("Field");
+		int maxNumTerms=DOMUtils.getAttribute(e,"maxNumTerms",defaultMaxNumTerms);
+		FuzzyLikeThisQuery fbq=new FuzzyLikeThisQuery(maxNumTerms,analyzer);
+		fbq.setIgnoreTF(DOMUtils.getAttribute(e,"ignoreTF",defaultIgnoreTF));
+		for(int i=0;i<nl.getLength();i++)
+		{
+			Element fieldElem=(Element) nl.item(i);
+			float minSimilarity=DOMUtils.getAttribute(fieldElem,"minSimilarity",defaultMinSimilarity);
+			int prefixLength=DOMUtils.getAttribute(fieldElem,"prefixLength",defaultPrefixLength);
+			String fieldName=DOMUtils.getAttributeWithInheritance(fieldElem,"fieldName");
+			
+			String value=DOMUtils.getText(fieldElem);
+			fbq.addTerms(value,fieldName,minSimilarity,prefixLength);
+		}
+		fbq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+
+		return fbq;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/FuzzyLikeThisQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,112 +1,112 @@
-/*
- * Created on 25-Jan-2006
- */
-package org.apache.lucene.xmlparser.builders;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.search.similar.MoreLikeThisQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-public class LikeThisQueryBuilder implements QueryBuilder {
-
-	private Analyzer analyzer;
-	String defaultFieldNames [];
-	int defaultMaxQueryTerms=20;
-	int defaultMinTermFrequency=1;
-	float defaultPercentTermsToMatch=30; //default is a 3rd of selected terms must match
-
-	public LikeThisQueryBuilder(Analyzer analyzer,String [] defaultFieldNames)
-	{
-		this.analyzer=analyzer;
-		this.defaultFieldNames=defaultFieldNames;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.apache.lucene.xmlparser.QueryObjectBuilder#process(org.w3c.dom.Element)
-	 */
-	public Query getQuery(Element e) throws ParserException {
-		String fieldsList=e.getAttribute("fieldNames"); //a comma-delimited list of fields
-		String fields[]=defaultFieldNames;
-		if((fieldsList!=null)&&(fieldsList.trim().length()>0))
-		{
-			fields=fieldsList.trim().split(",");
-			//trim the fieldnames
-			for (int i = 0; i < fields.length; i++) {
-				fields[i]=fields[i].trim();
-			}
-		}
-		
-		//Parse any "stopWords" attribute
-		//TODO MoreLikeThis needs to ideally have per-field stopWords lists - until then 
-		//I use all analyzers/fields to generate multi-field compatible stop list
-		String stopWords=e.getAttribute("stopWords");
-		Set stopWordsSet=null;
-		if((stopWords!=null)&&(fields!=null))
-		{
-		    stopWordsSet=new HashSet();
-                    final Token reusableToken = new Token();
-		    for (int i = 0; i < fields.length; i++)
-            {
-                TokenStream ts = analyzer.tokenStream(fields[i],new StringReader(stopWords));
-                try
-                {
-	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
-	                    stopWordsSet.add(nextToken.term());
-	                }
-                }
-                catch(IOException ioe)
-                {
-                    throw new ParserException("IoException parsing stop words list in "
-                            +getClass().getName()+":"+ioe.getLocalizedMessage());
-                }
-            }
-		}
-		
-		
-		MoreLikeThisQuery mlt=new MoreLikeThisQuery(DOMUtils.getText(e),fields,analyzer);
-		mlt.setMaxQueryTerms(DOMUtils.getAttribute(e,"maxQueryTerms",defaultMaxQueryTerms));
-		mlt.setMinTermFrequency(DOMUtils.getAttribute(e,"minTermFrequency",defaultMinTermFrequency));
-		mlt.setPercentTermsToMatch(DOMUtils.getAttribute(e,"percentTermsToMatch",defaultPercentTermsToMatch)/100);
-		mlt.setStopWords(stopWordsSet);
-		int minDocFreq=DOMUtils.getAttribute(e,"minDocFreq",-1);
-		if(minDocFreq>=0)
-		{
-			mlt.setMinDocFreq(minDocFreq);
-		}
-
-		mlt.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-
-		return mlt;
-	}
-
-
-
-}
+/*
+ * Created on 25-Jan-2006
+ */
+package org.apache.lucene.xmlparser.builders;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.search.similar.MoreLikeThisQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+public class LikeThisQueryBuilder implements QueryBuilder {
+
+	private Analyzer analyzer;
+	String defaultFieldNames [];
+	int defaultMaxQueryTerms=20;
+	int defaultMinTermFrequency=1;
+	float defaultPercentTermsToMatch=30; //default is a 3rd of selected terms must match
+
+	public LikeThisQueryBuilder(Analyzer analyzer,String [] defaultFieldNames)
+	{
+		this.analyzer=analyzer;
+		this.defaultFieldNames=defaultFieldNames;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.lucene.xmlparser.QueryObjectBuilder#process(org.w3c.dom.Element)
+	 */
+	public Query getQuery(Element e) throws ParserException {
+		String fieldsList=e.getAttribute("fieldNames"); //a comma-delimited list of fields
+		String fields[]=defaultFieldNames;
+		if((fieldsList!=null)&&(fieldsList.trim().length()>0))
+		{
+			fields=fieldsList.trim().split(",");
+			//trim the fieldnames
+			for (int i = 0; i < fields.length; i++) {
+				fields[i]=fields[i].trim();
+			}
+		}
+		
+		//Parse any "stopWords" attribute
+		//TODO MoreLikeThis needs to ideally have per-field stopWords lists - until then 
+		//I use all analyzers/fields to generate multi-field compatible stop list
+		String stopWords=e.getAttribute("stopWords");
+		Set stopWordsSet=null;
+		if((stopWords!=null)&&(fields!=null))
+		{
+		    stopWordsSet=new HashSet();
+                    final Token reusableToken = new Token();
+		    for (int i = 0; i < fields.length; i++)
+            {
+                TokenStream ts = analyzer.tokenStream(fields[i],new StringReader(stopWords));
+                try
+                {
+	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
+	                    stopWordsSet.add(nextToken.term());
+	                }
+                }
+                catch(IOException ioe)
+                {
+                    throw new ParserException("IoException parsing stop words list in "
+                            +getClass().getName()+":"+ioe.getLocalizedMessage());
+                }
+            }
+		}
+		
+		
+		MoreLikeThisQuery mlt=new MoreLikeThisQuery(DOMUtils.getText(e),fields,analyzer);
+		mlt.setMaxQueryTerms(DOMUtils.getAttribute(e,"maxQueryTerms",defaultMaxQueryTerms));
+		mlt.setMinTermFrequency(DOMUtils.getAttribute(e,"minTermFrequency",defaultMinTermFrequency));
+		mlt.setPercentTermsToMatch(DOMUtils.getAttribute(e,"percentTermsToMatch",defaultPercentTermsToMatch)/100);
+		mlt.setStopWords(stopWordsSet);
+		int minDocFreq=DOMUtils.getAttribute(e,"minDocFreq",-1);
+		if(minDocFreq>=0)
+		{
+			mlt.setMinDocFreq(minDocFreq);
+		}
+
+		mlt.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+
+		return mlt;
+	}
+
+
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/MatchAllDocsQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/MatchAllDocsQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/MatchAllDocsQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/MatchAllDocsQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,30 +1,30 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.MatchAllDocsQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class MatchAllDocsQueryBuilder implements QueryBuilder
-{
-	public Query getQuery(Element e) throws ParserException
-	{
-		return new MatchAllDocsQuery();
-	}
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class MatchAllDocsQueryBuilder implements QueryBuilder
+{
+	public Query getQuery(Element e) throws ParserException
+	{
+		return new MatchAllDocsQuery();
+	}
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/MatchAllDocsQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,45 +1,45 @@
-/*
- * Created on 25-Jan-2006
- */
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.RangeFilter;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.FilterBuilder;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-public class RangeFilterBuilder implements FilterBuilder {
-
-
-	public Filter getFilter(Element e) throws ParserException {
-		
-		String fieldName=DOMUtils.getAttributeWithInheritance(e,"fieldName");
-		
-		String lowerTerm=e.getAttribute("lowerTerm");
-		String upperTerm=e.getAttribute("upperTerm");
-		boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
-		boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
-		return new RangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
-	}
-
-}
+/*
+ * Created on 25-Jan-2006
+ */
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.RangeFilter;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.FilterBuilder;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+public class RangeFilterBuilder implements FilterBuilder {
+
+
+	public Filter getFilter(Element e) throws ParserException {
+		
+		String fieldName=DOMUtils.getAttributeWithInheritance(e,"fieldName");
+		
+		String lowerTerm=e.getAttribute("lowerTerm");
+		String upperTerm=e.getAttribute("upperTerm");
+		boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
+		boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
+		return new RangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanBuilderBase.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanBuilderBase.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanBuilderBase.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanBuilderBase.java Mon Nov 10 18:35:46 2008
@@ -1,29 +1,29 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.Query;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public abstract class SpanBuilderBase implements SpanQueryBuilder
-{
-	public Query getQuery(Element e) throws ParserException
-	{
-		return getSpanQuery(e);
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.Query;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public abstract class SpanBuilderBase implements SpanQueryBuilder
+{
+	public Query getQuery(Element e) throws ParserException
+	{
+		return getSpanQuery(e);
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanBuilderBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanFirstBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanFirstBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanFirstBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanFirstBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,46 +1,46 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.spans.SpanFirstQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanFirstBuilder extends SpanBuilderBase
-{
-    SpanQueryBuilder factory;
-    
-    public SpanFirstBuilder(SpanQueryBuilder factory)
-    {
-        super();
-        this.factory = factory;
-    }
-
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
-	    int end=DOMUtils.getAttribute(e,"end",1);
-	    Element child=DOMUtils.getFirstChildElement(e);
-	    SpanQuery q=factory.getSpanQuery(child);
-	    
-		SpanFirstQuery sfq = new SpanFirstQuery(q,end);
-		
-		sfq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-		return sfq;
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.spans.SpanFirstQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanFirstBuilder extends SpanBuilderBase
+{
+    SpanQueryBuilder factory;
+    
+    public SpanFirstBuilder(SpanQueryBuilder factory)
+    {
+        super();
+        this.factory = factory;
+    }
+
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+	    int end=DOMUtils.getAttribute(e,"end",1);
+	    Element child=DOMUtils.getFirstChildElement(e);
+	    SpanQuery q=factory.getSpanQuery(child);
+	    
+		SpanFirstQuery sfq = new SpanFirstQuery(q,end);
+		
+		sfq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+		return sfq;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanFirstBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNearBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNearBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNearBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNearBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,53 +1,53 @@
-package org.apache.lucene.xmlparser.builders;
-
-import java.util.ArrayList;
-
-import org.apache.lucene.search.spans.SpanNearQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanNearBuilder extends SpanBuilderBase
-{
-	SpanQueryBuilder factory;
-	public SpanNearBuilder(SpanQueryBuilder factory)
-	{
-		this.factory=factory;
-	}
-	
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
- 		String slopString=DOMUtils.getAttributeOrFail(e,"slop");
-  		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;
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import java.util.ArrayList;
+
+import org.apache.lucene.search.spans.SpanNearQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanNearBuilder extends SpanBuilderBase
+{
+	SpanQueryBuilder factory;
+	public SpanNearBuilder(SpanQueryBuilder factory)
+	{
+		this.factory=factory;
+	}
+	
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+ 		String slopString=DOMUtils.getAttributeOrFail(e,"slop");
+  		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;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNearBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNotBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNotBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNotBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNotBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,54 +1,54 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.search.spans.SpanNotQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanNotBuilder extends SpanBuilderBase
-{
-    
-    SpanQueryBuilder factory;    
-
-    /**
-     * @param factory
-     */
-    public SpanNotBuilder(SpanQueryBuilder factory)
-    {
-        super();
-        this.factory = factory;
-    }
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
-  	    Element includeElem=DOMUtils.getChildByTagOrFail(e,"Include");
-        includeElem=DOMUtils.getFirstChildOrFail(includeElem);
-
-  	    Element 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.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-		return snq;
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.search.spans.SpanNotQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanNotBuilder extends SpanBuilderBase
+{
+    
+    SpanQueryBuilder factory;    
+
+    /**
+     * @param factory
+     */
+    public SpanNotBuilder(SpanQueryBuilder factory)
+    {
+        super();
+        this.factory = factory;
+    }
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+  	    Element includeElem=DOMUtils.getChildByTagOrFail(e,"Include");
+        includeElem=DOMUtils.getFirstChildOrFail(includeElem);
+
+  	    Element 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.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+		return snq;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanNotBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,55 +1,55 @@
-package org.apache.lucene.xmlparser.builders;
-
-import java.util.ArrayList;
-
-import org.apache.lucene.search.spans.SpanOrQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanOrBuilder extends SpanBuilderBase
-{
-    
-    SpanQueryBuilder factory;
-    
-    public SpanOrBuilder(SpanQueryBuilder factory)
-    {
-        super();
-        this.factory = factory;
-    }
-    
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
-	    ArrayList clausesList=new ArrayList();
-		for (Node kid = e.getFirstChild(); kid != null; kid = kid.getNextSibling())
-		{
-			if (kid.getNodeType() == Node.ELEMENT_NODE) 
-			{
-				SpanQuery clause=factory.getSpanQuery((Element) kid);
-				clausesList.add(clause);				
-			}
-		}	    
-		SpanQuery[] clauses=(SpanQuery[]) clausesList.toArray(new SpanQuery[clausesList.size()]);
-		SpanOrQuery soq = new SpanOrQuery(clauses);		
-		soq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-		return soq;
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import java.util.ArrayList;
+
+import org.apache.lucene.search.spans.SpanOrQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanOrBuilder extends SpanBuilderBase
+{
+    
+    SpanQueryBuilder factory;
+    
+    public SpanOrBuilder(SpanQueryBuilder factory)
+    {
+        super();
+        this.factory = factory;
+    }
+    
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+	    ArrayList clausesList=new ArrayList();
+		for (Node kid = e.getFirstChild(); kid != null; kid = kid.getNextSibling())
+		{
+			if (kid.getNodeType() == Node.ELEMENT_NODE) 
+			{
+				SpanQuery clause=factory.getSpanQuery((Element) kid);
+				clausesList.add(clause);				
+			}
+		}	    
+		SpanQuery[] clauses=(SpanQuery[]) clausesList.toArray(new SpanQuery[clausesList.size()]);
+		SpanOrQuery soq = new SpanOrQuery(clauses);		
+		soq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+		return soq;
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrTermsBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrTermsBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrTermsBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrTermsBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,70 +1,70 @@
-package org.apache.lucene.xmlparser.builders;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.spans.SpanOrQuery;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.search.spans.SpanTermQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanOrTermsBuilder extends SpanBuilderBase
-{
-    Analyzer analyzer;
-    
-    
-    /**
-     * @param analyzer
-     */
-    public SpanOrTermsBuilder(Analyzer analyzer)
-    {
-        super();
-        this.analyzer = analyzer;
-    }
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
- 		String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
- 		String value=DOMUtils.getNonBlankTextOrFail(e);
-		
-		try
-		{
-			ArrayList clausesList=new ArrayList();
-			TokenStream ts=analyzer.tokenStream(fieldName,new StringReader(value));
-			final Token reusableToken = new Token();
-	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
-			    SpanTermQuery stq=new SpanTermQuery(new Term(fieldName,nextToken.term()));
-			    clausesList.add(stq);
-			}
-			SpanOrQuery soq=new SpanOrQuery((SpanQuery[]) clausesList.toArray(new SpanQuery[clausesList.size()]));
-			soq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-			return soq;
-		}
-		catch(IOException ioe)
-		{
-		    throw new ParserException("IOException parsing value:"+value);
-		}
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.spans.SpanOrQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanOrTermsBuilder extends SpanBuilderBase
+{
+    Analyzer analyzer;
+    
+    
+    /**
+     * @param analyzer
+     */
+    public SpanOrTermsBuilder(Analyzer analyzer)
+    {
+        super();
+        this.analyzer = analyzer;
+    }
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+ 		String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
+ 		String value=DOMUtils.getNonBlankTextOrFail(e);
+		
+		try
+		{
+			ArrayList clausesList=new ArrayList();
+			TokenStream ts=analyzer.tokenStream(fieldName,new StringReader(value));
+			final Token reusableToken = new Token();
+	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
+			    SpanTermQuery stq=new SpanTermQuery(new Term(fieldName,nextToken.term()));
+			    clausesList.add(stq);
+			}
+			SpanOrQuery soq=new SpanOrQuery((SpanQuery[]) clausesList.toArray(new SpanQuery[clausesList.size()]));
+			soq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+			return soq;
+		}
+		catch(IOException ioe)
+		{
+		    throw new ParserException("IOException parsing value:"+value);
+		}
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanOrTermsBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,28 +1,28 @@
-package org.apache.lucene.xmlparser.builders;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-
-
-public interface SpanQueryBuilder extends QueryBuilder{
-	
-	public SpanQuery getSpanQuery(Element e) throws ParserException;
-
-}
+package org.apache.lucene.xmlparser.builders;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+
+
+public interface SpanQueryBuilder extends QueryBuilder{
+	
+	public SpanQuery getSpanQuery(Element e) throws ParserException;
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilderFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilderFactory.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilderFactory.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilderFactory.java Mon Nov 10 18:35:46 2008
@@ -1,47 +1,47 @@
-package org.apache.lucene.xmlparser.builders;
-
-import java.util.HashMap;
-
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class SpanQueryBuilderFactory implements SpanQueryBuilder {
-
-	HashMap builders=new HashMap();
-	
-	public Query getQuery(Element e) throws ParserException {
-		return getSpanQuery(e);
-	}
-	public void addBuilder(String nodeName,SpanQueryBuilder builder)
-	{
-		builders.put(nodeName,builder);
-	}
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
-		SpanQueryBuilder builder=(SpanQueryBuilder) builders.get(e.getNodeName());
-		if(builder==null)
-		{
-			throw new ParserException("No SpanQueryObjectBuilder defined for node "+e.getNodeName()); 
-		}
-		return builder.getSpanQuery(e); 
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import java.util.HashMap;
+
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class SpanQueryBuilderFactory implements SpanQueryBuilder {
+
+	HashMap builders=new HashMap();
+	
+	public Query getQuery(Element e) throws ParserException {
+		return getSpanQuery(e);
+	}
+	public void addBuilder(String nodeName,SpanQueryBuilder builder)
+	{
+		builders.put(nodeName,builder);
+	}
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+		SpanQueryBuilder builder=(SpanQueryBuilder) builders.get(e.getNodeName());
+		if(builder==null)
+		{
+			throw new ParserException("No SpanQueryObjectBuilder defined for node "+e.getNodeName()); 
+		}
+		return builder.getSpanQuery(e); 
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanQueryBuilderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanTermBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanTermBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanTermBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanTermBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,39 +1,39 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.search.spans.SpanTermQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-public class SpanTermBuilder extends SpanBuilderBase
-{
-
-	public SpanQuery getSpanQuery(Element e) throws ParserException
-	{
- 		String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
- 		String value=DOMUtils.getNonBlankTextOrFail(e);
-  		SpanTermQuery stq = new SpanTermQuery(new Term(fieldName,value));
-  		
-  		stq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-		return stq;		
-		
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.spans.SpanQuery;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class SpanTermBuilder extends SpanBuilderBase
+{
+
+	public SpanQuery getSpanQuery(Element e) throws ParserException
+	{
+ 		String fieldName=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
+ 		String value=DOMUtils.getNonBlankTextOrFail(e);
+  		SpanTermQuery stq = new SpanTermQuery(new Term(fieldName,value));
+  		
+  		stq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+		return stq;		
+		
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/SpanTermBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermQueryBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermQueryBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermQueryBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,41 +1,41 @@
-package org.apache.lucene.xmlparser.builders;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.ParserException;
-import org.apache.lucene.xmlparser.QueryBuilder;
-import org.w3c.dom.Element;
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-public class TermQueryBuilder implements QueryBuilder {
-
-	public Query getQuery(Element e) throws ParserException {
-		
-        String field=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
- 		String value=DOMUtils.getNonBlankTextOrFail(e);
-  		TermQuery tq = new TermQuery(new Term(field,value));
-  		tq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
-
-  		return tq;
-		
-	}
-
-}
+package org.apache.lucene.xmlparser.builders;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.ParserException;
+import org.apache.lucene.xmlparser.QueryBuilder;
+import org.w3c.dom.Element;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+public class TermQueryBuilder implements QueryBuilder {
+
+	public Query getQuery(Element e) throws ParserException {
+		
+        String field=DOMUtils.getAttributeWithInheritanceOrFail(e,"fieldName");
+ 		String value=DOMUtils.getNonBlankTextOrFail(e);
+  		TermQuery tq = new TermQuery(new Term(field,value));
+  		tq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+
+  		return tq;
+		
+	}
+
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermQueryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermsFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermsFilterBuilder.java?rev=712922&r1=712921&r2=712922&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermsFilterBuilder.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermsFilterBuilder.java Mon Nov 10 18:35:46 2008
@@ -1,81 +1,81 @@
-package org.apache.lucene.xmlparser.builders;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.Token;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.search.TermsFilter;
-import org.apache.lucene.xmlparser.DOMUtils;
-import org.apache.lucene.xmlparser.FilterBuilder;
-import org.apache.lucene.xmlparser.ParserException;
-import org.w3c.dom.Element;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TermsFilterBuilder implements FilterBuilder
-{
-	Analyzer analyzer;
-	
-	/**
-	 * @param analyzer
-	 */
-	public TermsFilterBuilder(Analyzer analyzer)
-	{
-		this.analyzer = analyzer;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.lucene.xmlparser.FilterBuilder#process(org.w3c.dom.Element)
-	 */
-	public Filter getFilter(Element e) throws ParserException
-	{
-		TermsFilter tf = new TermsFilter();
-		String text = DOMUtils.getNonBlankTextOrFail(e);
-		String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
-		TokenStream ts = analyzer.tokenStream(fieldName, new StringReader(text));
-
-		try
-		{
-                  final Token reusableToken = new Token();
-			Term term = null;
-	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
-				if (term == null)
-				{
-					term = new Term(fieldName, nextToken.term());
-				} else
-				{
-//					 create from previous to save fieldName.intern overhead
-					term = term.createTerm(nextToken.term()); 
-				}
-				tf.addTerm(term);
-			}
-		} 
-		catch (IOException ioe)
-		{
-			throw new RuntimeException("Error constructing terms from index:"
-					+ ioe);
-		}
-		return tf;
-	}
-}
+package org.apache.lucene.xmlparser.builders;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.TermsFilter;
+import org.apache.lucene.xmlparser.DOMUtils;
+import org.apache.lucene.xmlparser.FilterBuilder;
+import org.apache.lucene.xmlparser.ParserException;
+import org.w3c.dom.Element;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TermsFilterBuilder implements FilterBuilder
+{
+	Analyzer analyzer;
+	
+	/**
+	 * @param analyzer
+	 */
+	public TermsFilterBuilder(Analyzer analyzer)
+	{
+		this.analyzer = analyzer;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.lucene.xmlparser.FilterBuilder#process(org.w3c.dom.Element)
+	 */
+	public Filter getFilter(Element e) throws ParserException
+	{
+		TermsFilter tf = new TermsFilter();
+		String text = DOMUtils.getNonBlankTextOrFail(e);
+		String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
+		TokenStream ts = analyzer.tokenStream(fieldName, new StringReader(text));
+
+		try
+		{
+                  final Token reusableToken = new Token();
+			Term term = null;
+	                for (Token nextToken = ts.next(reusableToken); nextToken != null; nextToken = ts.next(reusableToken)) {
+				if (term == null)
+				{
+					term = new Term(fieldName, nextToken.term());
+				} else
+				{
+//					 create from previous to save fieldName.intern overhead
+					term = term.createTerm(nextToken.term()); 
+				}
+				tf.addTerm(term);
+			}
+		} 
+		catch (IOException ioe)
+		{
+			throw new RuntimeException("Error constructing terms from index:"
+					+ ioe);
+		}
+		return tf;
+	}
+}

Propchange: lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/TermsFilterBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message