lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r898055 - in /lucene/java/trunk/contrib/benchmark: build.xml src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
Date Mon, 11 Jan 2010 20:29:41 GMT
Author: gsingers
Date: Mon Jan 11 20:29:40 2010
New Revision: 898055

URL: http://svn.apache.org/viewvc?rev=898055&view=rev
Log:
Add support for LongToEnglish doc/query maker

Added:
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
  (with props)
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
  (with props)
Modified:
    lucene/java/trunk/contrib/benchmark/build.xml

Modified: lucene/java/trunk/contrib/benchmark/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/build.xml?rev=898055&r1=898054&r2=898055&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/build.xml (original)
+++ lucene/java/trunk/contrib/benchmark/build.xml Mon Jan 11 20:29:40 2010
@@ -104,6 +104,7 @@
     <path id="classpath">
         <pathelement path="${common.dir}/build/classes/java"/>
         <pathelement path="${common.dir}/build/classes/demo"/>
+      <pathelement path="${common.dir}/build/classes/test"/>
         <pathelement path="${common.dir}/build/contrib/highlighter/classes/java"/>
         <pathelement path="${common.dir}/build/contrib/memory/classes/java"/>
         <pathelement path="${common.dir}/build/contrib/fast-vector-highlighter/classes/java"/>
@@ -120,7 +121,7 @@
     <property name="task.alg" location="conf/micro-standard.alg"/>
     <property name="task.mem" value="140M"/>
 
-    <target name="run-task" depends="compile,check-files,get-files" 
+    <target name="run-task" depends="compile-test,check-files,get-files" 
      description="Run compound penalty perf test (optional: -Dtask.alg=your-algorithm-file
-Dtask.mem=java-max-mem)">
         <echo>Working Directory: ${working.dir}</echo>
         <java classname="org.apache.lucene.benchmark.byTask.Benchmark" maxmemory="${task.mem}"
fork="true">

Added: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java?rev=898055&view=auto
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
(added)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
Mon Jan 11 20:29:40 2010
@@ -0,0 +1,37 @@
+package org.apache.lucene.benchmark.byTask.feeds;
+
+import org.apache.lucene.util.English;
+
+import java.io.IOException;
+import java.util.Date;
+
+
+/**
+ *
+ *
+ **/
+public class LongToEnglishContentSource extends ContentSource{
+  private long counter = Long.MIN_VALUE + 10;
+
+  public void close() throws IOException {
+
+  }
+  //TODO: reduce/clean up synchonization
+  public synchronized DocData getNextDocData(DocData docData) throws NoMoreDataException,
IOException {
+    docData.clear();
+    docData.setBody(English.longToEnglish(counter));
+    docData.setName("doc_" + String.valueOf(counter));
+    docData.setTitle("title_" + String.valueOf(counter));
+    docData.setDate(new Date());
+    if (counter == Long.MAX_VALUE){
+      counter = Long.MIN_VALUE + 10;//loop around
+    }
+    counter++;
+    return docData;
+  }
+
+  @Override
+  public void resetInputs() throws IOException {
+    counter = Long.MIN_VALUE + 10;
+  }
+}

Propchange: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishContentSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java?rev=898055&view=auto
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
(added)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
Mon Jan 11 20:29:40 2010
@@ -0,0 +1,49 @@
+package org.apache.lucene.benchmark.byTask.feeds;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.benchmark.byTask.tasks.NewAnalyzerTask;
+import org.apache.lucene.benchmark.byTask.utils.Config;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.util.English;
+import org.apache.lucene.util.Version;
+
+
+/**
+ *
+ *
+ **/
+public class LongToEnglishQueryMaker implements QueryMaker {
+  long counter = Long.MIN_VALUE + 10;
+  protected QueryParser parser;
+
+  public Query makeQuery(int size) throws Exception {
+    throw new UnsupportedOperationException();
+  }
+
+  public synchronized Query makeQuery() throws Exception {
+
+    return parser.parse("" + English.longToEnglish(getNextCounter()) + "");
+  }
+
+  private synchronized long getNextCounter() {
+    if (counter == Long.MAX_VALUE){
+      counter = Long.MIN_VALUE + 10;
+    }
+    return counter++;
+  }
+
+  public void setConfig(Config config) throws Exception {
+    Analyzer anlzr = NewAnalyzerTask.createAnalyzer(config.get("analyzer", StandardAnalyzer.class.getName()));
+    parser = new QueryParser(Version.LUCENE_CURRENT, DocMaker.BODY_FIELD, anlzr);
+  }
+
+  public void resetInputs() {
+    counter = Long.MIN_VALUE + 10;
+  }
+
+  public String printQueries() {
+    return "LongToEnglish: [" + Long.MIN_VALUE + " TO " + counter + "]";
+  }
+}

Propchange: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LongToEnglishQueryMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message