lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r928246 [2/6] - in /lucene/java/branches/flex_1458: ./ backwards/src/ backwards/src/java/org/apache/lucene/search/ backwards/src/test/org/apache/lucene/analysis/ backwards/src/test/org/apache/lucene/document/ backwards/src/test/org/apache/l...
Date Sat, 27 Mar 2010 19:12:13 GMT
Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
(original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java
Sat Mar 27 19:12:08 2010
@@ -22,20 +22,20 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
-import java.util.List;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
 /**
  * Perf run configuration properties.
- * <p>
- * Numeric property containing ":", e.g. "10:100:5" is interpreted 
- * as array of numeric values. It is extracted once, on first use, and 
+ * <p/>
+ * Numeric property containing ":", e.g. "10:100:5" is interpreted
+ * as array of numeric values. It is extracted once, on first use, and
  * maintain a round number to return the appropriate value.
- * <p>
- * The config property "work.dir" tells where is the root of 
+ * <p/>
+ * The config property "work.dir" tells where is the root of
  * docs data dirs and indexes dirs. It is set to either of: <ul>
  * <li>value supplied for it in the alg file;</li>
  * <li>otherwise, value of System property "benchmark.work.dir";</li>
@@ -48,30 +48,31 @@ public class Config {
 
   private int roundNumber = 0;
   private Properties props;
-  private HashMap<String,Object> valByRound = new HashMap<String,Object>();
-  private HashMap<String,String> colForValByRound = new HashMap<String,String>();
+  private HashMap<String, Object> valByRound = new HashMap<String, Object>();
+  private HashMap<String, String> colForValByRound = new HashMap<String, String>();
   private String algorithmText;
 
   /**
    * Read both algorithm and config properties.
+   *
    * @param algReader from where to read algorithm and config properties.
    * @throws IOException
    */
-  public Config (Reader algReader) throws IOException {
+  public Config(Reader algReader) throws IOException {
     // read alg file to array of lines
     ArrayList<String> lines = new ArrayList<String>();
     BufferedReader r = new BufferedReader(algReader);
-    int lastConfigLine=0;
-    for (String line = r.readLine(); line!=null; line=r.readLine()) {
+    int lastConfigLine = 0;
+    for (String line = r.readLine(); line != null; line = r.readLine()) {
       lines.add(line);
-      if (line.indexOf('=')>0) {
+      if (line.indexOf('=') > 0) {
         lastConfigLine = lines.size();
       }
     }
     r.close();
     // copy props lines to string
     StringBuffer sb = new StringBuffer();
-    for (int i=0; i<lastConfigLine; i++) {
+    for (int i = 0; i < lastConfigLine; i++) {
       sb.append(lines.get(i));
       sb.append(NEW_LINE);
     }
@@ -80,17 +81,17 @@ public class Config {
     props.load(new ByteArrayInputStream(sb.toString().getBytes()));
 
     // make sure work dir is set properly 
-    if (props.get("work.dir")==null) {
-      props.setProperty("work.dir",System.getProperty("benchmark.work.dir","work"));
+    if (props.get("work.dir") == null) {
+      props.setProperty("work.dir", System.getProperty("benchmark.work.dir", "work"));
     }
-    
-    if (Boolean.valueOf(props.getProperty("print.props","true")).booleanValue()) {
+
+    if (Boolean.valueOf(props.getProperty("print.props", "true")).booleanValue()) {
       printProps();
     }
-    
+
     // copy algorithm lines
     sb = new StringBuffer();
-    for (int i=lastConfigLine; i<lines.size(); i++) {
+    for (int i = lastConfigLine; i < lines.size(); i++) {
       sb.append(lines.get(i));
       sb.append(NEW_LINE);
     }
@@ -121,147 +122,176 @@ public class Config {
 
   /**
    * Return a string property.
+   *
    * @param name name of property.
    * @param dflt default value.
    * @return a string property.
    */
-  public String get (String name, String dflt) {
-    return props.getProperty(name,dflt);
+  public String get(String name, String dflt) {
+    String vals[] = (String[]) valByRound.get(name);
+    if (vals != null) {
+      return vals[roundNumber % vals.length];
+    }
+    // done if not by round
+    String sval = props.getProperty(name, dflt);
+    if (sval == null) {
+      return null;
+    }
+    if (sval.indexOf(":") < 0) {
+      return sval;
+    }
+    // first time this prop is extracted by round
+    int k = sval.indexOf(":");
+    String colName = sval.substring(0, k);
+    sval = sval.substring(k + 1);
+    colForValByRound.put(name, colName);
+    vals = propToStringArray(sval);
+    valByRound.put(name, vals);
+    return vals[roundNumber % vals.length];
   }
 
   /**
    * Set a property.
    * Note: once a multiple values property is set, it can no longer be modified.
-   * @param name name of property.
+   *
+   * @param name  name of property.
    * @param value either single or multiple property value (multiple values are separated
by ":")
-   * @throws Exception 
+   * @throws Exception
    */
-  public void set (String name, String value) throws Exception {
+  public void set(String name, String value) throws Exception {
     if (valByRound.get(name) != null) {
       throw new Exception("Cannot modify a multi value property!");
     }
-    props.setProperty(name,value);
+    props.setProperty(name, value);
   }
 
   /**
    * Return an int property.
-   * If the property contain ":", e.g. "10:100:5", it is interpreted 
+   * If the property contain ":", e.g. "10:100:5", it is interpreted
    * as array of ints. It is extracted once, on first call
-   * to get() it, and a by-round-value is returned. 
+   * to get() it, and a by-round-value is returned.
+   *
    * @param name name of property
    * @param dflt default value
    * @return a int property.
    */
-  public int get (String name, int dflt) {
+  public int get(String name, int dflt) {
     // use value by round if already parsed
     int vals[] = (int[]) valByRound.get(name);
     if (vals != null) {
       return vals[roundNumber % vals.length];
     }
     // done if not by round 
-    String sval = props.getProperty(name,""+dflt);
-    if (sval.indexOf(":")<0) {
+    String sval = props.getProperty(name, "" + dflt);
+    if (sval.indexOf(":") < 0) {
       return Integer.parseInt(sval);
     }
     // first time this prop is extracted by round
     int k = sval.indexOf(":");
-    String colName = sval.substring(0,k);
-    sval = sval.substring(k+1);
-    colForValByRound.put(name,colName);
+    String colName = sval.substring(0, k);
+    sval = sval.substring(k + 1);
+    colForValByRound.put(name, colName);
     vals = propToIntArray(sval);
-    valByRound.put(name,vals);
+    valByRound.put(name, vals);
     return vals[roundNumber % vals.length];
   }
-  
+
   /**
    * Return a double property.
-   * If the property contain ":", e.g. "10:100:5", it is interpreted 
+   * If the property contain ":", e.g. "10:100:5", it is interpreted
    * as array of doubles. It is extracted once, on first call
-   * to get() it, and a by-round-value is returned. 
+   * to get() it, and a by-round-value is returned.
+   *
    * @param name name of property
    * @param dflt default value
    * @return a double property.
    */
-  public double get (String name, double dflt) {
+  public double get(String name, double dflt) {
     // use value by round if already parsed
     double vals[] = (double[]) valByRound.get(name);
     if (vals != null) {
       return vals[roundNumber % vals.length];
     }
     // done if not by round 
-    String sval = props.getProperty(name,""+dflt);
-    if (sval.indexOf(":")<0) {
+    String sval = props.getProperty(name, "" + dflt);
+    if (sval.indexOf(":") < 0) {
       return Double.parseDouble(sval);
     }
     // first time this prop is extracted by round
     int k = sval.indexOf(":");
-    String colName = sval.substring(0,k);
-    sval = sval.substring(k+1);
-    colForValByRound.put(name,colName);
+    String colName = sval.substring(0, k);
+    sval = sval.substring(k + 1);
+    colForValByRound.put(name, colName);
     vals = propToDoubleArray(sval);
-    valByRound.put(name,vals);
+    valByRound.put(name, vals);
     return vals[roundNumber % vals.length];
   }
-  
+
   /**
    * Return a boolean property.
-   * If the property contain ":", e.g. "true.true.false", it is interpreted 
+   * If the property contain ":", e.g. "true.true.false", it is interpreted
    * as array of booleans. It is extracted once, on first call
-   * to get() it, and a by-round-value is returned. 
+   * to get() it, and a by-round-value is returned.
+   *
    * @param name name of property
    * @param dflt default value
    * @return a int property.
    */
-  public boolean get (String name, boolean dflt) {
+  public boolean get(String name, boolean dflt) {
     // use value by round if already parsed
     boolean vals[] = (boolean[]) valByRound.get(name);
     if (vals != null) {
       return vals[roundNumber % vals.length];
     }
     // done if not by round 
-    String sval = props.getProperty(name,""+dflt);
-    if (sval.indexOf(":")<0) {
+    String sval = props.getProperty(name, "" + dflt);
+    if (sval.indexOf(":") < 0) {
       return Boolean.valueOf(sval).booleanValue();
     }
     // first time this prop is extracted by round 
     int k = sval.indexOf(":");
-    String colName = sval.substring(0,k);
-    sval = sval.substring(k+1);
-    colForValByRound.put(name,colName);
+    String colName = sval.substring(0, k);
+    sval = sval.substring(k + 1);
+    colForValByRound.put(name, colName);
     vals = propToBooleanArray(sval);
-    valByRound.put(name,vals);
+    valByRound.put(name, vals);
     return vals[roundNumber % vals.length];
   }
-  
+
   /**
-   * Increment the round number, for config values that are extracted by round number. 
+   * Increment the round number, for config values that are extracted by round number.
+   *
    * @return the new round number.
    */
-  public int newRound () {
+  public int newRound() {
     roundNumber++;
-    
-    StringBuffer sb = new StringBuffer("--> Round ").append(roundNumber-1).append("-->").append(roundNumber);
+
+    StringBuffer sb = new StringBuffer("--> Round ").append(roundNumber - 1).append("-->").append(roundNumber);
 
     // log changes in values
-    if (valByRound.size()>0) {
+    if (valByRound.size() > 0) {
       sb.append(": ");
       for (final String name : valByRound.keySet()) {
         Object a = valByRound.get(name);
         if (a instanceof int[]) {
           int ai[] = (int[]) a;
-          int n1 = (roundNumber-1)%ai.length;
-          int n2 = roundNumber%ai.length;
+          int n1 = (roundNumber - 1) % ai.length;
+          int n2 = roundNumber % ai.length;
           sb.append("  ").append(name).append(":").append(ai[n1]).append("-->").append(ai[n2]);
-        } else if (a instanceof double[]){
+        } else if (a instanceof double[]) {
           double ad[] = (double[]) a;
-          int n1 = (roundNumber-1)%ad.length;
-          int n2 = roundNumber%ad.length;
+          int n1 = (roundNumber - 1) % ad.length;
+          int n2 = roundNumber % ad.length;
           sb.append("  ").append(name).append(":").append(ad[n1]).append("-->").append(ad[n2]);
-        }
-        else {
+        } else if (a instanceof String[]) {
+          String ad[] = (String[]) a;
+          int n1 = (roundNumber - 1) % ad.length;
+          int n2 = roundNumber % ad.length;
+          sb.append("  ").append(name).append(":").append(ad[n1]).append("-->").append(ad[n2]);
+        } else {
           boolean ab[] = (boolean[]) a;
-          int n1 = (roundNumber-1)%ab.length;
-          int n2 = roundNumber%ab.length;
+          int n1 = (roundNumber - 1) % ab.length;
+          int n2 = roundNumber % ab.length;
           sb.append("  ").append(name).append(":").append(ab[n1]).append("-->").append(ab[n2]);
         }
       }
@@ -270,62 +300,76 @@ public class Config {
     System.out.println();
     System.out.println(sb.toString());
     System.out.println();
-    
+
     return roundNumber;
   }
-  
+
+  private String[] propToStringArray(String s) {
+    if (s.indexOf(":") < 0) {
+      return new String[]{s};
+    }
+
+    ArrayList<String> a = new ArrayList<String>();
+    StringTokenizer st = new StringTokenizer(s, ":");
+    while (st.hasMoreTokens()) {
+      String t = st.nextToken();
+      a.add(t);
+    }
+    return (String[]) a.toArray(new String[a.size()]);
+  }
+
   // extract properties to array, e.g. for "10:100:5" return int[]{10,100,5}. 
-  private int[] propToIntArray (String s) {
-    if (s.indexOf(":")<0) {
-      return new int [] { Integer.parseInt(s) };
+  private int[] propToIntArray(String s) {
+    if (s.indexOf(":") < 0) {
+      return new int[]{Integer.parseInt(s)};
     }
-    
+
     ArrayList<Integer> a = new ArrayList<Integer>();
-    StringTokenizer st = new StringTokenizer(s,":");
+    StringTokenizer st = new StringTokenizer(s, ":");
     while (st.hasMoreTokens()) {
       String t = st.nextToken();
       a.add(Integer.valueOf(t));
     }
-    int res[] = new int[a.size()]; 
-    for (int i=0; i<a.size(); i++) {
+    int res[] = new int[a.size()];
+    for (int i = 0; i < a.size(); i++) {
       res[i] = a.get(i).intValue();
     }
     return res;
   }
-    
+
   // extract properties to array, e.g. for "10.7:100.4:-2.3" return int[]{10.7,100.4,-2.3}.

-  private double[] propToDoubleArray (String s) {
-    if (s.indexOf(":")<0) {
-      return new double [] { Double.parseDouble(s) };
+  private double[] propToDoubleArray(String s) {
+    if (s.indexOf(":") < 0) {
+      return new double[]{Double.parseDouble(s)};
     }
-    
+
     ArrayList<Double> a = new ArrayList<Double>();
-    StringTokenizer st = new StringTokenizer(s,":");
+    StringTokenizer st = new StringTokenizer(s, ":");
     while (st.hasMoreTokens()) {
       String t = st.nextToken();
       a.add(Double.valueOf(t));
     }
-    double res[] = new double[a.size()]; 
-    for (int i=0; i<a.size(); i++) {
+    double res[] = new double[a.size()];
+    for (int i = 0; i < a.size(); i++) {
       res[i] = a.get(i).doubleValue();
     }
     return res;
   }
-    
+
   // extract properties to array, e.g. for "true:true:false" return boolean[]{true,false,false}.

-  private boolean[] propToBooleanArray (String s) {
-    if (s.indexOf(":")<0) {
-      return new boolean [] { Boolean.valueOf(s).booleanValue() };
+  private boolean[] propToBooleanArray(String s) {
+    if (s.indexOf(":") < 0) {
+      return new boolean[]{Boolean.valueOf(s).booleanValue()};
     }
-    
+
     ArrayList<Boolean> a = new ArrayList<Boolean>();
-    StringTokenizer st = new StringTokenizer(s,":");
+    StringTokenizer st = new StringTokenizer(s, ":");
     while (st.hasMoreTokens()) {
       String t = st.nextToken();
       a.add(new Boolean(t));
     }
-    boolean res[] = new boolean[a.size()]; 
-    for (int i=0; i<a.size(); i++) {
+    boolean res[] = new boolean[a.size()];
+    for (int i = 0; i < a.size(); i++) {
       res[i] = a.get(i).booleanValue();
     }
     return res;
@@ -335,10 +379,10 @@ public class Config {
    * @return names of params set by round, for reports title
    */
   public String getColsNamesForValsByRound() {
-    if (colForValByRound.size()==0) {
+    if (colForValByRound.size() == 0) {
       return "";
     }
-    StringBuffer sb = new StringBuffer(); 
+    StringBuffer sb = new StringBuffer();
     for (final String name : colForValByRound.keySet()) {
       String colName = colForValByRound.get(name);
       sb.append(" ").append(colName);
@@ -350,33 +394,35 @@ public class Config {
    * @return values of params set by round, for reports lines.
    */
   public String getColsValuesForValsByRound(int roundNum) {
-    if (colForValByRound.size()==0) {
+    if (colForValByRound.size() == 0) {
       return "";
     }
-    StringBuffer sb = new StringBuffer(); 
-    for (final String name  : colForValByRound.keySet()) {
+    StringBuffer sb = new StringBuffer();
+    for (final String name : colForValByRound.keySet()) {
       String colName = colForValByRound.get(name);
-      String template = " "+colName;
-      if (roundNum<0) {
+      String template = " " + colName;
+      if (roundNum < 0) {
         // just append blanks
-        sb.append(Format.formatPaddLeft("-",template));
+        sb.append(Format.formatPaddLeft("-", template));
       } else {
         // append actual values, for that round
         Object a = valByRound.get(name);
         if (a instanceof int[]) {
           int ai[] = (int[]) a;
           int n = roundNum % ai.length;
-          sb.append(Format.format(ai[n],template));
-        }
-        else if (a instanceof double[]) {
+          sb.append(Format.format(ai[n], template));
+        } else if (a instanceof double[]) {
           double ad[] = (double[]) a;
           int n = roundNum % ad.length;
-          sb.append(Format.format(2, ad[n],template));
-        }
-        else {
+          sb.append(Format.format(2, ad[n], template));
+        } else if (a instanceof String[]) {
+          String ad[] = (String[]) a;
+          int n = roundNum % ad.length;
+          sb.append(ad[n]);
+        } else {
           boolean ab[] = (boolean[]) a;
           int n = roundNum % ab.length;
-          sb.append(Format.formatPaddLeft(""+ab[n],template));
+          sb.append(Format.formatPaddLeft("" + ab[n], template));
         }
       }
     }

Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
(original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/BenchmarkTestCase.java
Sat Mar 27 19:12:08 2010
@@ -19,10 +19,10 @@ package org.apache.lucene.benchmark;
 
 import java.io.File;
 
-import junit.framework.TestCase;
+import org.apache.lucene.util.LuceneTestCase;
 
 /** Base class for all Benchmark unit tests. */
-public class BenchmarkTestCase extends TestCase {
+public class BenchmarkTestCase extends LuceneTestCase {
 
   private static final File workDir;
 

Modified: lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
(original)
+++ lucene/java/branches/flex_1458/contrib/benchmark/src/test/org/apache/lucene/benchmark/quality/TestQualityRun.java
Sat Mar 27 19:12:08 2010
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 
+import org.apache.lucene.benchmark.BenchmarkTestCase;
 import org.apache.lucene.benchmark.byTask.TestPerfTasksLogic;
 import org.apache.lucene.benchmark.quality.Judge;
 import org.apache.lucene.benchmark.quality.QualityQuery;
@@ -44,44 +45,30 @@ import org.apache.lucene.util.LuceneTest
  * this test will not work correctly, as it does not dynamically
  * generate its test trec topics/qrels!
  */
-public class TestQualityRun extends LuceneTestCase {
+public class TestQualityRun extends BenchmarkTestCase {
   
-  public TestQualityRun(String name) {
-    super(name);
-  }
-
   public void testTrecQuality() throws Exception {
     // first create the partial reuters index
     createReutersIndex();
     
-    File workDir = new File(System.getProperty("benchmark.work.dir","work"));
-    assertTrue("Bad workDir: "+workDir, workDir.exists()&& workDir.isDirectory());
-
     int maxResults = 1000;
     String docNameField = "doctitle"; // orig docID is in the linedoc format title 
     
     PrintWriter logger = VERBOSE ? new PrintWriter(System.out,true) : null;
-
-    // <tests src dir> for topics/qrels files - src/test/org/apache/lucene/benchmark/quality
-    File srcTestDir = new File(new File(new File(new File(new File(
-      new File(new File(workDir.getAbsoluteFile().getParentFile(),
-        "src"),"test"),"org"),"apache"),"lucene"),"benchmark"),"quality");
-    
+   
     // prepare topics
-    File topicsFile = new File(srcTestDir, "trecTopics.txt");
-    assertTrue("Bad topicsFile: "+topicsFile, topicsFile.exists()&& topicsFile.isFile());
+    InputStream topics = getClass().getResourceAsStream("trecTopics.txt");
     TrecTopicsReader qReader = new TrecTopicsReader();
-    QualityQuery qqs[] = qReader.readQueries(new BufferedReader(new FileReader(topicsFile)));
+    QualityQuery qqs[] = qReader.readQueries(new BufferedReader(new InputStreamReader(topics,
"UTF-8")));
     
     // prepare judge
-    File qrelsFile = new File(srcTestDir, "trecQRels.txt");
-    assertTrue("Bad qrelsFile: "+qrelsFile, qrelsFile.exists()&& qrelsFile.isFile());
-    Judge judge = new TrecJudge(new BufferedReader(new FileReader(qrelsFile)));
+    InputStream qrels = getClass().getResourceAsStream("trecQRels.txt");
+    Judge judge = new TrecJudge(new BufferedReader(new InputStreamReader(qrels, "UTF-8")));
     
     // validate topics & judgments match each other
     judge.validateData(qqs, logger);
     
-    IndexSearcher searcher = new IndexSearcher(FSDirectory.open(new File(workDir,"index")),
true);
+    IndexSearcher searcher = new IndexSearcher(FSDirectory.open(new File(getWorkDir(),"index")),
true);
 
     QualityQueryParser qqParser = new SimpleQQParser("title","body");
     QualityBenchmark qrun = new QualityBenchmark(qqs, qqParser, searcher, docNameField);

Modified: lucene/java/branches/flex_1458/contrib/contrib-build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/contrib-build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/contrib-build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/contrib-build.xml Sat Mar 27 19:12:08 2010
@@ -27,20 +27,20 @@
   	
   <import file="../common-build.xml"/>
 
-  <property name="lucene.jar" location="${common.dir}/build/lucene-core-${version}.jar"/>
-  <available property="lucene.jar.present" type="file" file="${lucene.jar}"/>
-  <available property="lucene.tests.present" type="dir"
-             file="${common.dir}/build/classes/test" />
   <available property="contrib.has.tests" type="dir" file="src/test" />
   
-  <path id="classpath">
-   <pathelement path="${lucene.jar}"/>
+  <!-- if you extend the classpath refid in one contrib's build.xml (add JARs), use this
as basis: -->
+  <path id="base.classpath">
+   <pathelement location="${common.dir}/build/classes/java"/>
    <pathelement path="${project.classpath}"/>
   </path>
-
+  
+  <!-- default classpath refid, can be overridden by contrib's build.xml (use the above
base.classpath as basis): -->
+  <path id="classpath" refid="base.classpath"/>
+  
   <path id="test.classpath">
     <path refid="classpath"/>
-    <pathelement location="../../build/classes/test/"/>
+    <pathelement location="${common.dir}/build/classes/test"/>
     <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/java"/>
   </path>
@@ -52,16 +52,13 @@
     <pathelement path="${java.class.path}"/>
   </path>
 
-  <target name="build-lucene" unless="lucene.jar.present">
-    <ant dir="${common.dir}" target="jar-core" inheritAll="false"/>
-  </target>
-
-  <target name="build-lucene-tests" unless="lucene.tests.present">
+  <target name="build-lucene" unless="core.compiled">
     <ant dir="${common.dir}" target="compile-test" inheritAll="false"/>
+    <!-- set the property for this ant execution to speed up later tasks depending on
this -->
+    <property name="core.compiled" value="true"/>
   </target>
-
   
-  <target name="init" depends="common.init,build-lucene,build-lucene-tests"/>
+  <target name="init" depends="common.init,build-lucene"/>
   <target name="compile-test" depends="init" if="contrib.has.tests">
     <antcall target="common.compile-test" inheritRefs="true" />
   </target>
@@ -111,4 +108,18 @@
 ]]></echo>
   </target>
   
+  <macrodef name="contrib-uptodate">
+    <attribute name="name"/>
+    <attribute name="property" default="@{name}.uptodate"/>
+    <attribute name="classpath.property" default="@{name}.jar"/>
+    <!-- set jarfile only, if the target jar file has no generic name, applies to analyzers
with its common and smartcn subdir -->
+    <attribute name="jarfile" default="${common.dir}/build/contrib/@{name}/lucene-@{name}-${version}.jar"/>
+    <sequential>
+      <!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
+      <property name="@{classpath.property}" location="@{jarfile}"/>
+      <uptodate property="@{property}" targetfile="@{jarfile}">
+        <srcfiles dir="${common.dir}/contrib/@{name}/src/java" includes="**/*.java"/>
+      </uptodate>
+    </sequential>
+  </macrodef>
 </project>

Modified: lucene/java/branches/flex_1458/contrib/highlighter/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/highlighter/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/highlighter/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/highlighter/build.xml Sat Mar 27 19:12:08 2010
@@ -25,28 +25,24 @@
 
   <import file="../contrib-build.xml"/>
 
-  <property name="memory.jar" location="${common.dir}/build/contrib/memory/lucene-memory-${version}.jar"/>
-  <available property="memory.jar.present" type="file" file="${memory.jar}"/>
-  
-  <property name="regex.jar" location="${common.dir}/build/contrib/regex/lucene-regex-${version}.jar"/>
-  <available property="regex.jar.present" type="file" file="${regex.jar}"/>
+  <contrib-uptodate name="memory" property="memory.uptodate" classpath.property="memory.jar"/>
+  <contrib-uptodate name="queries" property="queries.uptodate" classpath.property="queries.jar"/>
 
   <path id="classpath">
-    <pathelement path="${lucene.jar}"/>
     <pathelement path="${memory.jar}"/>
-    <pathelement path="${regex.jar}"/>
-    <pathelement path="${project.classpath}"/>
+    <pathelement path="${queries.jar}"/>
+    <path refid="base.classpath"/>
   </path>
 
-  <target name="compile-core" depends="build-memory, build-regex, common.compile-core"
/>
+  <target name="compile-core" depends="build-memory, build-queries, common.compile-core"
/>
 
-  <target name="build-memory" unless="memory.jar.present">
-    <echo>Highlighter building dependency ${memory.jar}</echo>
+  <target name="build-memory" unless="memory.uptodate">
+    <echo>Highlighter building dependency contrib/memory</echo>
     <ant antfile="../memory/build.xml" target="default" inheritall="false" dir="../memory"
/>
   </target>
   
-  <target name="build-regex" unless="regex.jar.present">
-    <echo>Highlighter building dependency ${regex.jar}</echo>
-    <ant antfile="../regex/build.xml" target="default" inheritall="false" dir="../regex"
/>
+  <target name="build-queries" unless="queries.uptodate">
+    <echo>Highlighter building dependency contrib/queries</echo>
+    <ant antfile="../queries/build.xml" target="default" inheritall="false" dir="../queries"
/>
   </target>
 </project>

Propchange: lucene/java/branches/flex_1458/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar 27 19:12:08 2010
@@ -1,4 +1,4 @@
-/lucene/dev/trunk/lucene/contrib/highlighter/src/test:926653
+/lucene/dev/trunk/lucene/contrib/highlighter/src/test:926653,926948-928243
 /lucene/java/branches/lucene_2_4/contrib/highlighter/src/test:748824
 /lucene/java/branches/lucene_2_9/contrib/highlighter/src/test:817269-818600,825998,826775,829134,829816,829881,831036,896850,909334
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/highlighter/src/test:818601-821336

Propchange: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar 27 19:12:08 2010
@@ -1,4 +1,4 @@
-/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:926653
+/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:926653,926948-928243
 /lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:909334
 /lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919060,919119,919718,919731,919869,920237-920499,922013,922277,922525,922528,922583,922593,922602,922624,922797,922799,922806,922886-922887,923112,923238,924151,924207,924286,924321-924731,924781,925176-925462
 /lucene/solr/branches/newtrunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:926020-926289

Modified: lucene/java/branches/flex_1458/contrib/misc/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/misc/build.xml Sat Mar 27 19:12:08 2010
@@ -27,17 +27,4 @@
 
   <import file="../contrib-build.xml"/>
 
-  <property name="javacc.path" location="src/java/org/apache/lucene/queryParser/precedence"/>
-
-  <target name="javacc" depends="javacc-check" description="generate precedence query
parser from jj (requires javacc 3.2)">
-    <delete>
-      <fileset dir="${javacc.path}" includes="*.java">
-        <containsregexp expression="Generated.*By.*JavaCC"/>
-      </fileset>
-    </delete>
-    <invoke-javacc target="${javacc.path}/PrecedenceQueryParser.jj"
-                   outputDir="${javacc.path}"
-    />
-  </target>
-
 </project>

Modified: lucene/java/branches/flex_1458/contrib/queries/README.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/README.txt?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/README.txt (original)
+++ lucene/java/branches/flex_1458/contrib/queries/README.txt Sat Mar 27 19:12:08 2010
@@ -17,6 +17,7 @@ but reduces the overall score of docs co
 a sequence. An example might be a collection of primary keys from a database query result
or perhaps 
 a choice of "category" labels picked by the end user.
 
+==== RegexQuery - Implements the regular expression term search query. 
 
 Mark Harwood
 25/02/2006

Modified: lucene/java/branches/flex_1458/contrib/queries/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/queries/build.xml Sat Mar 27 19:12:08 2010
@@ -23,5 +23,14 @@
     Queries - various query object exotica not in core
   </description>
 
+  <path id="additional.dependencies">
+    <fileset dir="lib" includes="*-oro-*.jar,*-regexp-*.jar"/>
+  </path>
+
+  <pathconvert property="project.classpath"
+               targetos="unix"
+               refid="additional.dependencies"
+  />
+
   <import file="../contrib-build.xml"/>
 </project>

Modified: lucene/java/branches/flex_1458/contrib/queries/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queries/pom.xml.template?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queries/pom.xml.template (original)
+++ lucene/java/branches/flex_1458/contrib/queries/pom.xml.template Sat Mar 27 19:12:08 2010
@@ -35,4 +35,11 @@
     Queries - various query object exotica not in core
   </description>
   <packaging>jar</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>jakarta-regexp</groupId>
+      <artifactId>jakarta-regexp</artifactId>
+      <version>${jakarta-regexp-version}</version>
+    </dependency>
+  </dependencies>
 </project>

Modified: lucene/java/branches/flex_1458/contrib/queryparser/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/queryparser/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/queryparser/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/queryparser/build.xml Sat Mar 27 19:12:08 2010
@@ -28,7 +28,9 @@
   <!--
     NOTE: see the README.javacc for details on how to fully regenerate the parser
   -->
-  <target name="javacc" depends="init,javacc-check" if="javacc.present">
+  <target name="javacc" depends="javacc-flexible,javacc-precedence"/>
+
+  <target name="javacc-flexible" depends="init,javacc-check" if="javacc.present">
     <invoke-javacc target="src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj"
                    outputDir="src/java/org/apache/lucene/queryParser/standard/parser"
     />
@@ -86,5 +88,17 @@
   	                         flags="g"
   	                         byline="false"/>
   </target>
+  
+  <property name="javacc.precedence.path" location="src/java/org/apache/lucene/queryParser/precedence"/>
 
+  <target name="javacc-precedence" depends="javacc-check" description="generate precedence
query parser from jj (requires javacc 3.2)">
+    <delete>
+      <fileset dir="${javacc.precedence.path}" includes="*.java">
+        <containsregexp expression="Generated.*By.*JavaCC"/>
+      </fileset>
+    </delete>
+    <invoke-javacc target="${javacc.precedence.path}/PrecedenceQueryParser.jj"
+                   outputDir="${javacc.precedence.path}"
+    />
+  </target>
 </project>

Modified: lucene/java/branches/flex_1458/contrib/spatial/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/spatial/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/spatial/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/spatial/build.xml Sat Mar 27 19:12:08 2010
@@ -25,18 +25,16 @@
 
   <import file="../contrib-build.xml"/>
 
-  <property name="misc.jar" location="${common.dir}/build/contrib/misc/lucene-misc-${version}.jar"/>
-  <available property="misc.jar.present" type="file" file="${misc.jar}"/>
+  <contrib-uptodate name="misc" property="misc.uptodate" classpath.property="misc.jar"/>
 
   <path id="classpath">
-    <pathelement path="${lucene.jar}"/>
     <pathelement path="${misc.jar}"/>
-    <pathelement path="${project.classpath}"/>
+    <path refid="base.classpath"/>
   </path>
 
   <target name="compile-core" depends="build-misc, common.compile-core" />
 
-  <target name="build-misc" unless="misc.jar.present">
+  <target name="build-misc" unless="misc.uptodate">
     <echo>Misc building dependency ${misc.jar}</echo>
     <ant antfile="../misc/build.xml" target="default" inheritall="false" dir="../misc"
/>
   </target>

Modified: lucene/java/branches/flex_1458/contrib/spellchecker/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/spellchecker/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/spellchecker/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/spellchecker/build.xml Sat Mar 27 19:12:08 2010
@@ -24,6 +24,4 @@
   </description>
 
   <import file="../contrib-build.xml"/>
-  <target name="compile-test"
-          depends="build-lucene-tests,contrib-build.compile-test" />
 </project>

Modified: lucene/java/branches/flex_1458/contrib/xml-query-parser/LuceneCoreQuery.dtd
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/xml-query-parser/LuceneCoreQuery.dtd?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/xml-query-parser/LuceneCoreQuery.dtd (original)
+++ lucene/java/branches/flex_1458/contrib/xml-query-parser/LuceneCoreQuery.dtd Sat Mar 27
19:12:08 2010
@@ -54,8 +54,8 @@
 
 <!-- @hidden Define core types of XML elements -->
 <!ENTITY % coreSpanQueries "SpanOr|SpanNear|SpanOrTerms|SpanFirst|SpanNot|SpanTerm|BoostingTermQuery"
>
-<!ENTITY % coreQueries "BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery|BoostingTermQuery"
>
-<!ENTITY % coreFilters "RangeFilter|CachedFilter" >
+<!ENTITY % coreQueries "BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery|BoostingTermQuery|NumericRangeQuery"
>
+<!ENTITY % coreFilters "RangeFilter|NumericRangeFilter|CachedFilter" >
 
 <!-- @hidden Allow for extensions -->
 <!ENTITY % extendedSpanQueries1 " " >
@@ -283,7 +283,60 @@ Passes content directly through to the s
 <!-- Controls if the upperTerm in the range is part of the allowed set of values -->
 <!ATTLIST RangeFilter includeUpper (true | false) "true">
 
+<!--
+	A Query that matches numeric values within a specified range.
+	@example 
+	        <em>Search for documents about people who are aged 20-25</em>
+	        %	          
+            <NumericRangeQuery fieldName="age" lowerTerm="20" upperTerm="25" />
+	         %
+	-->
+<!ELEMENT NumericRangeQuery EMPTY>
+<!-- fieldName must be defined here or is taken from the most immediate parent XML element
that defines a "fieldName" attribute -->	
+<!ATTLIST NumericRangeQuery fieldName CDATA #IMPLIED>
+<!-- The lower-most term value for this field (must be <= upperTerm and a valid native
java numeric type) -->
+<!ATTLIST NumericRangeQuery lowerTerm CDATA #REQUIRED>
+<!-- The upper-most term value for this field (must be >= lowerTerm and a valid native
java numeric type) -->
+<!ATTLIST NumericRangeQuery upperTerm CDATA #REQUIRED>
+<!-- The numeric type of this field -->
+<!ATTLIST NumericRangeQuery type (int | long | float | double) "int">
+<!-- Controls if the lowerTerm in the range is part of the allowed set of values -->
+<!ATTLIST NumericRangeQuery includeLower (true | false) "true">
+<!-- Controls if the upperTerm in the range is part of the allowed set of values -->
+<!ATTLIST NumericRangeQuery includeUpper (true | false) "true">
+<!-- Lower step values mean more precisions and so more terms in index (and index gets
larger). This value must be an integer -->
+<!ATTLIST NumericRangeQuery precisionStep CDATA "4">
 
+<!--
+	A Filter that only accepts numeric values within a specified range
+	@example 
+	        <em>Search for documents about people who are aged 20-25</em>
+	        %	          
+            <FilteredQuery>
+               <Query>
+                  <UserQuery>person</UserQuery>
+               </Query>	
+               <Filter>
+                     <NumericRangeFilter fieldName="age" lowerTerm="20" upperTerm="25"/>
+               </Filter>	
+            </FilteredQuery>
+	         %
+	-->
+<!ELEMENT NumericRangeFilter EMPTY>
+<!-- fieldName must be defined here or is taken from the most immediate parent XML element
that defines a "fieldName" attribute -->	
+<!ATTLIST NumericRangeFilter fieldName CDATA #IMPLIED>
+<!-- The lower-most term value for this field (must be <= upperTerm and a valid native
java numeric type) -->
+<!ATTLIST NumericRangeFilter lowerTerm CDATA #REQUIRED>
+<!-- The upper-most term value for this field (must be >= lowerTerm and a valid native
java numeric type) -->
+<!ATTLIST NumericRangeFilter upperTerm CDATA #REQUIRED>
+<!-- The numeric type of this field -->
+<!ATTLIST NumericRangeFilter type (int | long | float | double) "int">
+<!-- Controls if the lowerTerm in the range is part of the allowed set of values -->
+<!ATTLIST NumericRangeFilter includeLower (true | false) "true">
+<!-- Controls if the upperTerm in the range is part of the allowed set of values -->
+<!ATTLIST NumericRangeFilter includeUpper (true | false) "true">
+<!-- Lower step values mean more precisions and so more terms in index (and index gets
larger). This value must be an integer -->
+<!ATTLIST NumericRangeFilter precisionStep CDATA "4">
 
 <!-- A single term used in a SpanQuery. These clauses are the building blocks for more
complex "span" queries which test word proximity
 	@example <em>Find documents using terms close to each other about mining and accidents</em>

Modified: lucene/java/branches/flex_1458/contrib/xml-query-parser/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/xml-query-parser/build.xml?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/xml-query-parser/build.xml (original)
+++ lucene/java/branches/flex_1458/contrib/xml-query-parser/build.xml Sat Mar 27 19:12:08
2010
@@ -25,28 +25,27 @@
 
   <import file="../contrib-build.xml"/>
 
-  <property name="queries.jar" location="${common.dir}/build/contrib/queries/lucene-queries-${version}.jar"/>
+  <contrib-uptodate name="queries" property="queries.uptodate" classpath.property="queries.jar"/>
+  <property name="lucene.jar" location="${common.dir}/build/lucene-core-${version}.jar"/>
   <property name="servlet.jar" location="${common.dir}/lib/servlet-api-2.4.jar"/>
-  <available property="queries.jar.present" type="file" file="${queries.jar}"/>
   <available property="servlet.jar.present" type="file" file="${servlet.jar}"/>
 
 
   <path id="classpath">
-    <pathelement path="${lucene.jar}"/>
     <pathelement path="${queries.jar}"/>
-    <pathelement path="${project.classpath}"/>
+    <path refid="base.classpath"/>
   </path>
 
   <path id="web-classpath">
-    <pathelement path="${lucene.jar}"/>
     <pathelement path="${queries.jar}"/>
     <pathelement path="${servlet.jar}"/>
     <pathelement path="${build.dir}/${final.name}.jar"/>
+    <path refid="base.classpath"/>
   </path>
 
   <target name="compile-core" depends="build-queries, common.compile-core" />
 
-  <target name="build-queries" unless="queries.jar.present">
+  <target name="build-queries" unless="queries.uptodate">
     <echo>XML Parser building dependency ${queries.jar}</echo>
     <ant antfile="../queries/build.xml" target="default" inheritall="false" dir="../queries"
/>
   </target>
@@ -59,6 +58,9 @@
   <target name="build-web-demo"  description="Compiles demo" if="servlet.jar.present">
 
     <echo>XML Parser compiling web demo</echo>
+
+    <ant dir="${common.dir}" target="jar-core" inheritAll="false"/>
+
     <compile
       srcdir="src/demo/java"
       destdir="${build.dir}/classes/webdemo">

Modified: lucene/java/branches/flex_1458/contrib/xml-query-parser/docs/LuceneContribQuery.dtd.entities.html
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/xml-query-parser/docs/LuceneContribQuery.dtd.entities.html?rev=928246&r1=928245&r2=928246&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/xml-query-parser/docs/LuceneContribQuery.dtd.entities.html
(original)
+++ lucene/java/branches/flex_1458/contrib/xml-query-parser/docs/LuceneContribQuery.dtd.entities.html
Sat Mar 27 19:12:08 2010
@@ -59,13 +59,13 @@ LuceneCoreQuery.dtd <i>(system)</i>
 <tr>
 <td>coreSpanQueries</td>
 <td>
-SpanOr|SpanNear|SpanOrTerms|SpanFirst|SpanNot|SpanTerm
+SpanOr|SpanNear|SpanOrTerms|SpanFirst|SpanNot|SpanTerm|BoostingTermQuery
 </td>
 </tr>
 <tr>
 <td>coreFilters</td>
 <td>
-RangeFilter|CachedFilter
+RangeFilter|NumericRangeFilter|CachedFilter
 </td>
 </tr>
 <tr>
@@ -83,7 +83,7 @@ RangeFilter|CachedFilter
 <tr>
 <td>coreQueries</td>
 <td>
-BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery
+BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery|BoostingTermQuery|NumericRangeQuery
 </td>
 </tr>
 </tbody>



Mime
View raw message