lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mharw...@apache.org
Subject svn commit: r545333 - in /lucene/java/trunk/contrib: queries/src/java/org/apache/lucene/search/similar/ xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/ xml-query-parser/src/test/org/apache/lucene/xmlparser/
Date Thu, 07 Jun 2007 22:13:38 GMT
Author: mharwood
Date: Thu Jun  7 15:13:37 2007
New Revision: 545333

URL: http://svn.apache.org/viewvc?view=rev&rev=545333
Log:
Exposed the MoreLikeThis "minDocFreq" property for use in MoreLikeThisQuery.java and in XML
queries

Modified:
    lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThisQuery.java
    lucene/java/trunk/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/LikeThisQueryBuilder.java
    lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/LikeThisQuery.xml

Modified: lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThisQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThisQuery.java?view=diff&rev=545333&r1=545332&r2=545333
==============================================================================
--- lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThisQuery.java
(original)
+++ lucene/java/trunk/contrib/queries/src/java/org/apache/lucene/search/similar/MoreLikeThisQuery.java
Thu Jun  7 15:13:37 2007
@@ -31,6 +31,7 @@
     int minTermFrequency=1;
     int maxQueryTerms=5;
     Set stopWords=null;
+	int minDocFreq=-1;
     
     
     /**
@@ -50,6 +51,10 @@
         mlt.setFieldNames(moreLikeFields);
         mlt.setAnalyzer(analyzer);
         mlt.setMinTermFreq(minTermFrequency);
+        if(minDocFreq>=0)
+        {
+        	mlt.setMinDocFreq(minDocFreq);
+        }        
         mlt.setMaxQueryTerms(maxQueryTerms);
         mlt.setStopWords(stopWords);
         BooleanQuery bq= (BooleanQuery) mlt.like(new ByteArrayInputStream(likeText.getBytes()));
       
@@ -130,4 +135,14 @@
     {
         this.stopWords = stopWords;
     }
+
+	public int getMinDocFreq()
+	{
+		return minDocFreq;
+	}
+
+	public void setMinDocFreq(int minDocFreq)
+	{
+		this.minDocFreq = minDocFreq;
+	}
 }

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?view=diff&rev=545333&r1=545332&r2=545333
==============================================================================
--- 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
Thu Jun  7 15:13:37 2007
@@ -100,6 +100,11 @@
 		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));
 

Modified: lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/LikeThisQuery.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/LikeThisQuery.xml?view=diff&rev=545333&r1=545332&r2=545333
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/LikeThisQuery.xml
(original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/LikeThisQuery.xml
Thu Jun  7 15:13:37 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<LikeThisQuery percentTermsToMatch="5" stopWords="Reuter">
+<LikeThisQuery percentTermsToMatch="5" stopWords="Reuter" minDocFreq="2">
 IRAQI TROOPS REPORTED PUSHING BACK IRANIANS Iraq said today its troops were pushing Iranian
forces out of 
 	positions they had initially occupied when they launched a new offensive near the southern
port of 
 	Basra early yesterday.     A High Command communique said Iraqi troops had won a significant
victory 



Mime
View raw message