You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2010/10/26 10:15:36 UTC
svn commit: r1027396 [3/4] - in /lucene/dev/branches/docvalues: ./ lucene/
lucene/contrib/
lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/
lucene/contrib/highlighter/src/test/
lucene/contrib/instantiated/src/test/org/apache/luce...
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/TestSizeBoundedOptimize.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/TestSizeBoundedOptimize.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/TestSizeBoundedOptimize.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/index/TestSizeBoundedOptimize.java Tue Oct 26 08:15:33 2010
@@ -34,14 +34,21 @@ public class TestSizeBoundedOptimize ext
writer.commit();
}
+ private static IndexWriterConfig newWriterConfig() throws IOException {
+ IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
+ conf.setRAMBufferSizeMB(IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB);
+ // prevent any merges by default.
+ conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ return conf;
+ }
+
public void testByteSizeLimit() throws Exception {
// tests that the max merge size constraint is applied during optimize.
Directory dir = new RAMDirectory();
// Prepare an index w/ several small segments and a large one.
- IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
- // prevent any merges from happening.
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
final int numSegments = 15;
for (int i = 0; i < numSegments; i++) {
@@ -54,7 +61,7 @@ public class TestSizeBoundedOptimize ext
sis.read(dir);
double min = sis.info(0).sizeInBytes();
- conf = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogByteSizeMergePolicy lmp = new LogByteSizeMergePolicy();
lmp.setMaxMergeMB((min + 1) / (1 << 20));
conf.setMergePolicy(lmp);
@@ -74,9 +81,7 @@ public class TestSizeBoundedOptimize ext
Directory dir = new RAMDirectory();
// Prepare an index w/ several small segments and a large one.
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- // prevent any merges from happening.
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -89,7 +94,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -107,8 +112,7 @@ public class TestSizeBoundedOptimize ext
public void testLastSegmentTooLarge() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -118,7 +122,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -135,8 +139,7 @@ public class TestSizeBoundedOptimize ext
public void testFirstSegmentTooLarge() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 5);
@@ -146,7 +149,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -163,8 +166,7 @@ public class TestSizeBoundedOptimize ext
public void testAllSegmentsSmall() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -174,7 +176,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -191,8 +193,7 @@ public class TestSizeBoundedOptimize ext
public void testAllSegmentsLarge() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -201,7 +202,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(2);
conf.setMergePolicy(lmp);
@@ -218,8 +219,7 @@ public class TestSizeBoundedOptimize ext
public void testOneLargeOneSmall() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -229,7 +229,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -246,8 +246,7 @@ public class TestSizeBoundedOptimize ext
public void testMergeFactor() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -260,7 +259,7 @@ public class TestSizeBoundedOptimize ext
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
lmp.setMergeFactor(2);
@@ -280,8 +279,7 @@ public class TestSizeBoundedOptimize ext
public void testSingleNonOptimizedSegment() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
@@ -295,7 +293,7 @@ public class TestSizeBoundedOptimize ext
r.deleteDocument(r.numDocs() - 1);
r.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -314,15 +312,14 @@ public class TestSizeBoundedOptimize ext
public void testSingleOptimizedSegment() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 3);
writer.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(3);
conf.setMergePolicy(lmp);
@@ -340,8 +337,7 @@ public class TestSizeBoundedOptimize ext
public void testSingleNonOptimizedTooLargeSegment() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
- conf.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
+ IndexWriterConfig conf = newWriterConfig();
IndexWriter writer = new IndexWriter(dir, conf);
addDocs(writer, 5);
@@ -353,7 +349,7 @@ public class TestSizeBoundedOptimize ext
r.deleteDocument(r.numDocs() - 1);
r.close();
- conf = newIndexWriterConfig(TEST_VERSION_CURRENT, null);
+ conf = newWriterConfig();
LogMergePolicy lmp = new LogDocMergePolicy();
lmp.setMaxMergeDocs(2);
conf.setMergePolicy(lmp);
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java Tue Oct 26 08:15:33 2010
@@ -541,7 +541,10 @@ public class TestQueryParser extends Luc
public void testRange() throws Exception {
assertQueryEquals("[ a TO z]", null, "[a TO z]");
- assertEquals(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, ((TermRangeQuery)getQuery("[ a TO z]", null)).getRewriteMethod());
+ assertQueryEquals("[ a TO z}", null, "[a TO z}");
+ assertQueryEquals("{ a TO z]", null, "{a TO z]");
+
+ assertEquals(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, ((TermRangeQuery)getQuery("[ a TO z]", null)).getRewriteMethod());
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "field", new MockAnalyzer(MockTokenizer.SIMPLE, true));
qp.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
@@ -555,7 +558,12 @@ public class TestQueryParser extends Luc
assertQueryEquals("[ a TO z] AND bar", null, "+[a TO z] +bar");
assertQueryEquals("( bar blar { a TO z}) ", null, "bar blar {a TO z}");
assertQueryEquals("gack ( bar blar { a TO z}) ", null, "gack (bar blar {a TO z})");
- }
+
+ assertQueryEquals("[* TO Z]",null,"[* TO z]");
+ assertQueryEquals("[A TO *]",null,"[a TO *]");
+ assertQueryEquals("[* TO *]",null,"[* TO *]");
+ assertQueryEquals("[\\* TO \"*\"]",null,"[\\* TO \\*]");
+ }
public void testFarsiRangeCollating() throws Exception {
Directory ramDir = newDirectory();
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java Tue Oct 26 08:15:33 2010
@@ -138,7 +138,7 @@ public class TestRegexpRandom2 extends L
String codec = CodecProvider.getDefaultCodec();
int num = codec.equals("PreFlex") ? 100 * RANDOM_MULTIPLIER : 1000 * RANDOM_MULTIPLIER;
for (int i = 0; i < num; i++) {
- String reg = AutomatonTestUtil.randomRegexp(random).toString();
+ String reg = AutomatonTestUtil.randomRegexp(random);
assertSame(reg);
}
}
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java Tue Oct 26 08:15:33 2010
@@ -35,7 +35,6 @@ import org.apache.lucene.index.codecs.mo
import org.apache.lucene.index.codecs.preflex.PreFlexCodec;
import org.apache.lucene.index.codecs.preflexrw.PreFlexRWCodec;
import org.apache.lucene.index.codecs.pulsing.PulsingCodec;
-import org.apache.lucene.index.codecs.simpletext.SimpleTextCodec;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.FieldCache.CacheEntry;
@@ -56,8 +55,6 @@ import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.NoTestsRemainException;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
@@ -193,7 +190,7 @@ public abstract class LuceneTestCase ext
private static Map<MockDirectoryWrapper,StackTraceElement[]> stores;
- private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock", "SimpleText"};
+ private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock"};
private static void swapCodec(Codec c) {
final CodecProvider cp = CodecProvider.getDefault();
@@ -246,7 +243,6 @@ public abstract class LuceneTestCase ext
swapCodec(new MockFixedIntBlockCodec(codecHasParam && "MockFixedIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(random, 1, 2000)));
// baseBlockSize cannot be over 127:
swapCodec(new MockVariableIntBlockCodec(codecHasParam && "MockVariableIntBlock".equals(codec) ? codecParam : _TestUtil.nextInt(random, 1, 127)));
- swapCodec(new SimpleTextCodec());
return cp.lookup(codec);
}
@@ -301,6 +297,7 @@ public abstract class LuceneTestCase ext
}
/** @deprecated: until we fix no-fork problems in solr tests */
+ @Deprecated
private static List<String> testClassesRun = new ArrayList<String>();
@BeforeClass
Propchange: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
-/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:943137,949730,957490,960490,961612,979161,980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:943137,949730,957490,960490,961612,979161,980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:967125-979432
-/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:1021634-1025711
+/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:1021634-1027393
/lucene/java/branches/flex_1458/src/test/org/apache/lucene/util/TestAttributeSource.java:824912-931101
/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java:909334,948516
/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:924483-924731,924781,925176-925462
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/AutomatonTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/AutomatonTestUtil.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/AutomatonTestUtil.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/AutomatonTestUtil.java Tue Oct 26 08:15:33 2010
@@ -33,16 +33,15 @@ import org.apache.lucene.util._TestUtil;
public class AutomatonTestUtil {
/** Returns random string, including full unicode range. */
- public static RegExp randomRegexp(Random r) {
+ public static String randomRegexp(Random r) {
while (true) {
String regexp = randomRegexpString(r);
// we will also generate some undefined unicode queries
if (!UnicodeUtil.validUTF16String(regexp))
continue;
try {
- // NOTE: we parse-tostring-parse again, because we are
- // really abusing RegExp.toString() here (its just for debugging)
- return new RegExp(new RegExp(regexp, RegExp.NONE).toString(), RegExp.NONE);
+ new RegExp(regexp, RegExp.NONE);
+ return regexp;
} catch (Exception e) {}
}
}
@@ -250,4 +249,128 @@ public class AutomatonTestUtil {
return ArrayUtil.toIntArray(soFar);
}
}
+
+ /** return a random NFA/DFA for testing */
+ public static Automaton randomAutomaton(Random random) {
+ // get two random Automata from regexps
+ Automaton a1 = new RegExp(AutomatonTestUtil.randomRegexp(random), RegExp.NONE).toAutomaton();
+ if (random.nextBoolean())
+ a1 = BasicOperations.complement(a1);
+
+ Automaton a2 = new RegExp(AutomatonTestUtil.randomRegexp(random), RegExp.NONE).toAutomaton();
+ if (random.nextBoolean())
+ a2 = BasicOperations.complement(a2);
+
+ // combine them in random ways
+ switch(random.nextInt(4)) {
+ case 0: return BasicOperations.concatenate(a1, a2);
+ case 1: return BasicOperations.union(a1, a2);
+ case 2: return BasicOperations.intersection(a1, a2);
+ default: return BasicOperations.minus(a1, a2);
+ }
+ }
+
+ /**
+ * below are original, unoptimized implementations of DFA operations for testing.
+ * These are from brics automaton, full license (BSD) below:
+ */
+
+ /*
+ * dk.brics.automaton
+ *
+ * Copyright (c) 2001-2009 Anders Moeller
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ /**
+ * Simple, original brics implementation of Brzozowski minimize()
+ */
+ public static void minimizeSimple(Automaton a) {
+ if (a.isSingleton())
+ return;
+ determinizeSimple(a, SpecialOperations.reverse(a));
+ determinizeSimple(a, SpecialOperations.reverse(a));
+ }
+
+ /**
+ * Simple, original brics implementation of determinize()
+ */
+ public static void determinizeSimple(Automaton a) {
+ if (a.deterministic || a.isSingleton())
+ return;
+ Set<State> initialset = new HashSet<State>();
+ initialset.add(a.initial);
+ determinizeSimple(a, initialset);
+ }
+
+ /**
+ * Simple, original brics implementation of determinize()
+ * Determinizes the given automaton using the given set of initial states.
+ */
+ public static void determinizeSimple(Automaton a, Set<State> initialset) {
+ int[] points = a.getStartPoints();
+ // subset construction
+ Map<Set<State>, Set<State>> sets = new HashMap<Set<State>, Set<State>>();
+ LinkedList<Set<State>> worklist = new LinkedList<Set<State>>();
+ Map<Set<State>, State> newstate = new HashMap<Set<State>, State>();
+ sets.put(initialset, initialset);
+ worklist.add(initialset);
+ a.initial = new State();
+ newstate.put(initialset, a.initial);
+ while (worklist.size() > 0) {
+ Set<State> s = worklist.removeFirst();
+ State r = newstate.get(s);
+ for (State q : s)
+ if (q.accept) {
+ r.accept = true;
+ break;
+ }
+ for (int n = 0; n < points.length; n++) {
+ Set<State> p = new HashSet<State>();
+ for (State q : s)
+ for (Transition t : q.getTransitions())
+ if (t.min <= points[n] && points[n] <= t.max)
+ p.add(t.to);
+ if (!sets.containsKey(p)) {
+ sets.put(p, p);
+ worklist.add(p);
+ newstate.put(p, new State());
+ }
+ State q = newstate.get(p);
+ int min = points[n];
+ int max;
+ if (n + 1 < points.length)
+ max = points[n + 1] - 1;
+ else
+ max = Character.MAX_CODE_POINT;
+ r.addTransition(new Transition(min, max, q));
+ }
+ }
+ a.deterministic = true;
+ a.clearNumberedStates();
+ a.removeDeadTransitions();
+ }
+
}
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestBasicOperations.java Tue Oct 26 08:15:33 2010
@@ -56,6 +56,13 @@ public class TestBasicOperations extends
assertTrue(BasicOperations.sameLanguage(other, concat2));
}
+ /** Test concatenation with empty language returns empty */
+ public void testEmptyLanguageConcatenate() {
+ Automaton a = BasicAutomata.makeString("a");
+ Automaton concat = BasicOperations.concatenate(a, BasicAutomata.makeEmpty());
+ assertTrue(BasicOperations.isEmpty(concat));
+ }
+
/** Test optimization to concatenate() with empty String to an NFA */
public void testEmptySingletonNFAConcatenate() {
Automaton singleton = BasicAutomata.makeString("");
@@ -79,7 +86,7 @@ public class TestBasicOperations extends
singleton = BasicAutomata.makeString("\ud801\udc1c");
expandedSingleton = singleton.cloneExpanded();
- //assertEquals(singleton, expandedSingleton);
+ assertTrue(BasicOperations.sameLanguage(singleton, expandedSingleton));
}
public void testGetRandomAcceptedString() throws Throwable {
@@ -87,7 +94,7 @@ public class TestBasicOperations extends
final int ITER2 = 100 * RANDOM_MULTIPLIER;
for(int i=0;i<ITER1;i++) {
- final RegExp re = AutomatonTestUtil.randomRegexp(random);
+ final RegExp re = new RegExp(AutomatonTestUtil.randomRegexp(random), RegExp.NONE);
final Automaton a = re.toAutomaton();
assertFalse(BasicOperations.isEmpty(a));
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java Tue Oct 26 08:15:33 2010
@@ -20,21 +20,30 @@ package org.apache.lucene.util.automaton
import org.apache.lucene.util.LuceneTestCase;
/**
- * Not thorough, but tries to test determinism correctness
+ * Not completely thorough, but tries to test determinism correctness
* somewhat randomly.
*/
public class TestDeterminism extends LuceneTestCase {
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
-
/** test a bunch of random regular expressions */
public void testRegexps() throws Exception {
int num = 500 * RANDOM_MULTIPLIER;
for (int i = 0; i < num; i++)
- assertAutomaton(AutomatonTestUtil.randomRegexp(random).toAutomaton());
+ assertAutomaton(new RegExp(AutomatonTestUtil.randomRegexp(random), RegExp.NONE).toAutomaton());
+ }
+
+ /** test against a simple, unoptimized det */
+ public void testAgainstSimple() throws Exception {
+ int num = 2000 * RANDOM_MULTIPLIER;
+ for (int i = 0; i < num; i++) {
+ Automaton a = AutomatonTestUtil.randomAutomaton(random);
+ Automaton b = a.clone();
+ AutomatonTestUtil.determinizeSimple(a);
+ b.deterministic = false; // force det
+ b.determinize();
+ // TODO: more verifications possible?
+ assertTrue(BasicOperations.sameLanguage(a, b));
+ }
}
private static void assertAutomaton(Automaton a) {
Modified: lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (original)
+++ lucene/dev/branches/docvalues/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java Tue Oct 26 08:15:33 2010
@@ -204,7 +204,7 @@ public class TestUTF32ToUTF8 extends Luc
public void testRandomRegexes() throws Exception {
int num = 250 * RANDOM_MULTIPLIER;
for (int i = 0; i < num; i++) {
- assertAutomaton(AutomatonTestUtil.randomRegexp(random).toAutomaton());
+ assertAutomaton(new RegExp(AutomatonTestUtil.randomRegexp(random), RegExp.NONE).toAutomaton());
}
}
Propchange: lucene/dev/branches/docvalues/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
-/lucene/dev/branches/branch_3x/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java:980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java:980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java:967125-979432
-/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java:1021634-1025711
+/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestISOLatin1AccentFilter.java:1021634-1027393
/lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:824912-931101
/lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:748824
/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:829134,829881,831036,896850,909334
Propchange: lucene/dev/branches/docvalues/solr/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
-/lucene/dev/branches/branch_3x/solr:949730,957490*,961612,979161,980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/solr:949730,957490*,961612,979161,980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/solr:967125-979432
-/lucene/dev/trunk/solr:1021634-1025711
+/lucene/dev/trunk/solr:1021634-1027393
/lucene/java/branches/lucene_2_4/solr:748824
/lucene/java/branches/lucene_2_9/solr:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr:818601-821336
Modified: lucene/dev/branches/docvalues/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/CHANGES.txt?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/CHANGES.txt (original)
+++ lucene/dev/branches/docvalues/solr/CHANGES.txt Tue Oct 26 08:15:33 2010
@@ -523,12 +523,16 @@ Bug Fixes
* SOLR-2148: Highlighter doesn't support q.alt. (koji)
-* SOLR-2139: Wrong cast from string to float (Igor Rodionov via koji)
-
* SOLR-2157 Suggester should return alpha-sorted results when onlyMorePopular=false (ab)
* SOLR-1794: Dataimport of CLOB fields fails when getCharacterStream() is
defined in a superclass. (Gunnar Gauslaa Bergem via rmuir)
+
+* SOLR-2173: Suggester should always rebuild Lookup data if Lookup.load fails. (ab)
+
+* SOLR-2190: change xpath from RSS 0.9 to 1.0 in slashdot sample. (koji)
+
+* SOLR-1962: SolrCore#initIndex should not use a mix of indexPath and newIndexPath (Mark Miller)
Other Changes
----------------------
Propchange: lucene/dev/branches/docvalues/solr/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/CHANGES.txt:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/CHANGES.txt:967125-979432
-/lucene/dev/trunk/solr/CHANGES.txt:1021634-1025711
+/lucene/dev/trunk/solr/CHANGES.txt:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/CHANGES.txt:748824
/lucene/java/branches/lucene_2_9/solr/CHANGES.txt:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/CHANGES.txt:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/KEYS
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/KEYS:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/KEYS:967125-979432
-/lucene/dev/trunk/solr/KEYS:1021634-1025711
+/lucene/dev/trunk/solr/KEYS:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/KEYS:748824
/lucene/java/branches/lucene_2_9/solr/KEYS:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/KEYS:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/LICENSE.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/LICENSE.txt:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/LICENSE.txt:967125-979432
-/lucene/dev/trunk/solr/LICENSE.txt:1021634-1025711
+/lucene/dev/trunk/solr/LICENSE.txt:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/LICENSE.txt:748824
/lucene/java/branches/lucene_2_9/solr/LICENSE.txt:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/LICENSE.txt:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/NOTICE.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/NOTICE.txt:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/NOTICE.txt:967125-979432
-/lucene/dev/trunk/solr/NOTICE.txt:1021634-1025711
+/lucene/dev/trunk/solr/NOTICE.txt:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/NOTICE.txt:748824
/lucene/java/branches/lucene_2_9/solr/NOTICE.txt:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/NOTICE.txt:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/README.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/README.txt:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/README.txt:967125-979432
-/lucene/dev/trunk/solr/README.txt:1021634-1025711
+/lucene/dev/trunk/solr/README.txt:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/README.txt:748824
/lucene/java/branches/lucene_2_9/solr/README.txt:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/README.txt:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/build.xml:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/build.xml:967125-979432
-/lucene/dev/trunk/solr/build.xml:1021634-1025711
+/lucene/dev/trunk/solr/build.xml:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/build.xml:748824
/lucene/java/branches/lucene_2_9/solr/build.xml:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/build.xml:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/client/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/client:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/client:967125-979432
-/lucene/dev/trunk/solr/client:1021634-1025711
+/lucene/dev/trunk/solr/client:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/client:748824
/lucene/java/branches/lucene_2_9/solr/client:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/client:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/common-build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/common-build.xml:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/common-build.xml:967125-979432
-/lucene/dev/trunk/solr/common-build.xml:1021634-1025711
+/lucene/dev/trunk/solr/common-build.xml:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/common-build.xml:748824
/lucene/java/branches/lucene_2_9/solr/common-build.xml:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/common-build.xml:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/contrib:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/contrib:967125-979432
-/lucene/dev/trunk/solr/contrib:1021634-1025711
+/lucene/dev/trunk/solr/contrib:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/contrib:748824
/lucene/java/branches/lucene_2_9/solr/contrib:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/contrib:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/example/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/example:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/example:967125-979432
-/lucene/dev/trunk/solr/example:1021634-1025711
+/lucene/dev/trunk/solr/example:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/example:748824
/lucene/java/branches/lucene_2_9/solr/example:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/example:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/db/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 08:15:33 2010
@@ -0,0 +1 @@
+data
Modified: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/db/conf/db-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/example-DIH/solr/db/conf/db-data-config.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/example-DIH/solr/db/conf/db-data-config.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/example-DIH/solr/db/conf/db-data-config.xml Tue Oct 26 08:15:33 2010
@@ -1,7 +1,7 @@
<dataConfig>
<dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:./example-DIH/hsqldb/ex" user="sa" />
<document>
- <entity name="item" query="select * from item"
+ <entity name="item" query="select * from item"
deltaQuery="select id from item where last_modified > '${dataimporter.last_index_time}'">
<field column="NAME" name="name" />
<field column="NAME" name="nameSort" />
Propchange: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/mail/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 08:15:33 2010
@@ -0,0 +1 @@
+data
Propchange: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 08:15:33 2010
@@ -0,0 +1 @@
+data
Propchange: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 26 08:15:33 2010
@@ -0,0 +1 @@
+dataimport.properties
Modified: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml Tue Oct 26 08:15:33 2010
@@ -1,26 +1,21 @@
<dataConfig>
- <dataSource type="HttpDataSource" />
- <document>
- <entity name="slashdot"
- pk="link"
- url="http://rss.slashdot.org/Slashdot/slashdot"
- processor="XPathEntityProcessor"
- forEach="/RDF/channel | /RDF/item"
- transformer="DateFormatTransformer">
-
- <field column="source" xpath="/RDF/channel/title" commonField="true" />
- <field column="source-link" xpath="/RDF/channel/link" commonField="true" />
- <field column="subject" xpath="/RDF/channel/subject" commonField="true" />
+ <dataSource type="HttpDataSource" />
+ <document>
+ <entity name="slashdot"
+ pk="link"
+ url="http://rss.slashdot.org/Slashdot/slashdot"
+ processor="XPathEntityProcessor"
+ forEach="/rss/channel/item"
+ transformer="DateFormatTransformer">
- <field column="title" xpath="/RDF/item/title" />
- <field column="link" xpath="/RDF/item/link" />
- <field column="description" xpath="/RDF/item/description" />
- <field column="creator" xpath="/RDF/item/creator" />
- <field column="item-subject" xpath="/RDF/item/subject" />
- <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" />
- <field column="slash-department" xpath="/RDF/item/department" />
- <field column="slash-section" xpath="/RDF/item/section" />
- <field column="slash-comments" xpath="/RDF/item/comments" />
- </entity>
- </document>
+ <field column="title" xpath="/rss/channel/item/title" />
+ <field column="link" xpath="/rss/channel/item/link" />
+ <field column="description" xpath="/rss/channel/item/description" />
+ <field column="creator" xpath="/rss/channel/item/creator" />
+ <field column="item-subject" xpath="/rss/channel/item/subject" />
+ <field column="date" xpath="/rss/channel/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" />
+ <field column="slash-department" xpath="/rss/channel/item/department" />
+ <field column="slash-section" xpath="/rss/channel/item/section" />
+ </entity>
+ </document>
</dataConfig>
Modified: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/schema.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/schema.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/example-DIH/solr/rss/conf/schema.xml Tue Oct 26 08:15:33 2010
@@ -294,11 +294,10 @@
<field name="link" type="string" indexed="true" stored="true" />
<field name="description" type="html" indexed="true" stored="true" />
<field name="creator" type="string" indexed="false" stored="true" />
- <field name="item-subject" type="string" indexed="true" stored="false" />
- <field name="date" type="date" indexed="true" stored="false" />
- <field name="slash-department" type="string" indexed="true" stored="false" />
- <field name="slash-section" type="string" indexed="true" stored="false" />
- <field name="slash-comments" type="sint" indexed="true" stored="true" />
+ <field name="item-subject" type="string" indexed="true" stored="true" />
+ <field name="date" type="date" indexed="true" stored="true" />
+ <field name="slash-department" type="string" indexed="true" stored="true" />
+ <field name="slash-section" type="string" indexed="true" stored="true" />
<field name="all_text" type="text" indexed="true" stored="false" multiValued="true" />
<copyField source="source" dest="all_text" />
Modified: lucene/dev/branches/docvalues/solr/example/example-DIH/solr/tika/conf/tika-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/example-DIH/solr/tika/conf/tika-data-config.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/example-DIH/solr/tika/conf/tika-data-config.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/example-DIH/solr/tika/conf/tika-data-config.xml Tue Oct 26 08:15:33 2010
@@ -1,10 +1,10 @@
<dataConfig>
- <dataSource type="BinFileDataSource" />
- <document>
+ <dataSource type="BinFileDataSource" />
+ <document>
<entity name="tika-test" processor="TikaEntityProcessor" url="../contrib/extraction/src/test/resources/solr-word.pdf" format="text">
<field column="Author" name="author" meta="true"/>
<field column="title" name="title" meta="true"/>
<field column="text" name="text"/>
</entity>
- </document>
+ </document>
</dataConfig>
Modified: lucene/dev/branches/docvalues/solr/example/exampledocs/hd.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/exampledocs/hd.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/exampledocs/hd.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/exampledocs/hd.xml Tue Oct 26 08:15:33 2010
@@ -28,7 +28,8 @@
<field name="popularity">6</field>
<field name="inStock">true</field>
<field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
- <field name="store">45.17614,-93.87341</field>
+ <!-- Near Oklahoma city -->
+ <field name="store">35.0752,-97.032</field>
</doc>
<doc>
Modified: lucene/dev/branches/docvalues/solr/example/exampledocs/ipod_video.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/exampledocs/ipod_video.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/exampledocs/ipod_video.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/exampledocs/ipod_video.xml Tue Oct 26 08:15:33 2010
@@ -32,7 +32,7 @@
<field name="price">399.00</field>
<field name="popularity">10</field>
<field name="inStock">true</field>
- <!-- San Francisco store -->
- <field name="store">37.7752,-122.4232</field>
+ <!-- Dodge City store -->
+ <field name="store">37.7752,-100.0232</field>
<field name="manufacturedate_dt">2005-10-12T08:00:00Z</field>
</doc></add>
Modified: lucene/dev/branches/docvalues/solr/example/exampledocs/mem.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/exampledocs/mem.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/exampledocs/mem.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/exampledocs/mem.xml Tue Oct 26 08:15:33 2010
@@ -43,8 +43,8 @@
<field name="price">74.99</field>
<field name="popularity">7</field>
<field name="inStock">true</field>
- <!-- San Francisco store -->
- <field name="store">37.7752,-122.4232</field>
+ <!-- Dodge City store -->
+ <field name="store">37.7752,-100.0232</field>
<field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
<field name="payloads">electronics|4.0 memory|2.0</field>
Modified: lucene/dev/branches/docvalues/solr/example/exampledocs/monitor.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/exampledocs/monitor.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/exampledocs/monitor.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/exampledocs/monitor.xml Tue Oct 26 08:15:33 2010
@@ -28,6 +28,6 @@
<field name="popularity">6</field>
<field name="inStock">true</field>
<!-- Buffalo store -->
- <field name="store">45.17614,-93.87341</field>
+ <field name="store">43.17614,-90.57341</field>
</doc></add>
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/schema.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/schema.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/schema.xml Tue Oct 26 08:15:33 2010
@@ -73,9 +73,8 @@
<!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
<fieldtype name="binary" class="solr.BinaryField"/>
- <!-- The optional sortMissingLast and sortMissingFirst attributes are
- currently supported on types that are sorted internally as strings.
- This includes "string","boolean","sint","slong","sfloat","sdouble","pdate"
+ <!-- sortMissingLast and sortMissingFirst attributes are optional attributes
+ that control how fields are sorted when values are missing.
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
@@ -140,11 +139,10 @@
<!--
Note:
- These should only be used for compatibility with existing indexes (created with older Solr versions)
- or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
+ These should only be used for compatibility with existing indexes (created with lucene or older Solr versions).
Plain numeric field types that store and index the text
- value verbatim (and hence don't support range queries, since the
+ value verbatim (and hence don't correctly support range queries, since the
lexicographic ordering isn't equal to the numeric ordering)
-->
<fieldType name="pint" class="solr.IntField" omitNorms="true"/>
@@ -153,23 +151,6 @@
<fieldType name="pdouble" class="solr.DoubleField" omitNorms="true"/>
<fieldType name="pdate" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
-
- <!--
- Note:
- These should only be used for compatibility with existing indexes (created with older Solr versions)
- or if "sortMissingFirst" or "sortMissingLast" functionality is needed. Use Trie based fields instead.
-
- Numeric field types that manipulate the value into
- a string value that isn't human-readable in its internal form,
- but with a lexicographic ordering the same as the numeric ordering,
- so that range queries work correctly.
- -->
- <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
- <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
- <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
- <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
-
-
<!-- The "RandomSortField" is not used to store or search any
data. You can declare fields of this type it in your schema
to generate pseudo-random orderings of your docs for sorting
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/solrconfig.xml?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/solrconfig.xml Tue Oct 26 08:15:33 2010
@@ -513,13 +513,18 @@
<str name="title">Solritas</str>
<!-- Query settings -->
- <str name="defType">dismax</str>
+ <str name="defType">edismax</str>
<str name="qf">
text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
</str>
<str name="q.alt">*:*</str>
<str name="rows">10</str>
<str name="fl">*,score</str>
+ <str name="mlt.qf">
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
+ </str>
+ <str name="mlt.fl">text,features,name,sku,id,manu,cat</str>
+ <int name="mlt.count">3</int>
<!-- Faceting defaults -->
<str name="facet">on</str>
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/VM_global_library.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/VM_global_library.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/VM_global_library.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/VM_global_library.vm Tue Oct 26 08:15:33 2010
@@ -1,23 +1,31 @@
+
#macro(param $key)$request.params.get($key)#end
#macro(url_for_solr)/solr#if($request.core.name != "")/$request.core.name#end#end
#macro(url_for_home)#url_for_solr/browse#end
-#macro(q)q=$!{esc.url($params.get('q'))}#end
+#macro(q)&q=$!{esc.url($params.get('q'))}#end
#macro(fqs $p)#foreach($fq in $p)#if($velocityCount>1)&#{end}fq=$esc.url($fq)#end#end
#macro(debug)#if($request.params.get('debugQuery'))&debugQuery=true#end#end
-#macro(boostPrice)#if($request.params.get('bf') == 'price')CHECKED#end#end
+#macro(boostPrice)#if($request.params.get('bf') == 'price')&bf=price#end#end
+
+#macro(annotate)#if($request.params.get('annotateBrowse'))&annotateBrowse=true#end#end
+
+#macro(annTitle $msg)#if($annotate == true)title="$msg"#end#end
+
+#macro(spatial)#if($request.params.get('sfield'))&sfield=store#end#if($request.params.get('pt'))&pt=$request.params.get('pt')#end#if($request.params.get('d'))&d=$request.params.get('d')#end#end
-#macro(lens)?#q#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#if($request.params.get('bf') == 'price')&bf=price#end#end
+#macro(lensNoQ)?#if($request.params.getParams('fq') and $list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug#boostPrice#annotate#spatial#end
+#macro(lens)#lensNoQ#q#end
#macro(url_for_lens)#{url_for_home}#lens#end
#macro(url_for_start $start)#url_for_home#lens&start=$start#end
-#macro(url_for_filters $p)#url_for_home?#q#if($list.size($p) > 0)&#fqs($p)#end#debug#end
+#macro(url_for_filters $p)#url_for_home?#q#boostPrice#spatial#if($list.size($p) > 0)&#fqs($p)#end#debug#end
#macro(url_for_nested_facet_query $field)#url_for_home#lens&fq=$esc.url($field)#end
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/browse.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/browse.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/browse.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/browse.vm Tue Oct 26 08:15:33 2010
@@ -1,32 +1,9 @@
#set($searcher=$request.searcher)
#set($params=$request.params)
#set($clusters = $response.response.clusters)
-
-<div class="query-box">
- <form id="query-form" action="#{url_for_home}" method="GET">
- <a href="#url_for_home#if($request.params.get('debugQuery'))?debugQuery=true#end"><img src="#{url_for_solr}/admin/solr_small.png" id="logo"/></a>
-
- <div class="inputs"><span>Find: <input type="text" id="q" name="q" value="$!esc.html($params.get('q'))"/> <input type="submit"/> <input type="reset"/></span>
- <div class="query-boost"><input type="checkbox" name="bf" value="price" #boostPrice>Boost by Price</input> </div></div>
- #if($request.params.get('debugQuery'))
- <input type="hidden" name="debugQuery" value="true"/>
- #end
- #foreach($fq in $request.params.getParams('fq'))
- <input type="hidden" name="fq" value="$esc.html($fq)"/>
- #end
- <div class="constraints">
- #foreach($fq in $params.getParams('fq'))
- #set($previous_fq_count=$velocityCount - 1)
- > <a style="{text-decoration: line-through;}" href="#url_for_filters($request.params.getParams('fq').subList(0,$previous_fq_count))">$fq</a>
- #end
- </div>
- #if($request.params.get('debugQuery'))
- <a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle parsed query</a>
- <pre style="display:none">$response.response.debug.parsedquery</pre>
- #end
- </form>
-</div>
-
+#set($mltResults = $response.response.get("moreLikeThis"))
+#set($annotate = $params.get("annotateBrowse"))
+#parse('query.vm')
#if($response.response.spellcheck.suggestions and $response.response.spellcheck.suggestions.size() > 0)
Did you mean <a href="#url_for_home?q=$esc.url($response.response.spellcheck.suggestions.collation)#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#debug">$response.response.spellcheck.suggestions.collation</a>?
#end
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_dates.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_dates.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_dates.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_dates.vm Tue Oct 26 08:15:33 2010
@@ -1,4 +1,5 @@
##TODO: Generically deal with all dates
+<h2 #annTitle("Facets generated by adding &facet.date= to the request")>Date Facets</h2>
#set($field = $response.response.facet_counts.facet_dates.manufacturedate_dt)
#set($gap = $response.response.facet_counts.facet_dates.manufacturedate_dt.gap)
#display_facet_date($field, "Manufacture Date", "manufacturedate_dt", $gap)
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_pivot.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_pivot.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_pivot.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_pivot.vm Tue Oct 26 08:15:33 2010
@@ -1,2 +1,3 @@
+<h2 #annTitle("Facets generated by adding &facet.pivot= to the request")>Pivot Facets</h2>
#set($pivot = $response.response.facet_counts.facet_pivot)
-#display_facet_pivot($pivot, "Pivots")
+#display_facet_pivot($pivot, "")
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_queries.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_queries.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_queries.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_queries.vm Tue Oct 26 08:15:33 2010
@@ -1,2 +1,3 @@
#set($field = $response.response.facet_counts.facet_queries)
-#display_facet_query($field, "Facet Queries", "")
\ No newline at end of file
+<h2 #annTitle("Facets generated by adding &facet.query= to the request")>Query Facets</h2>
+#display_facet_query($field, "", "")
\ No newline at end of file
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_ranges.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_ranges.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_ranges.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facet_ranges.vm Tue Oct 26 08:15:33 2010
@@ -1,3 +1,4 @@
+<h2 #annTitle("Facets generated by adding &facet.range= to the request")>Range Facets</h2>
#set($field = $response.response.facet_counts.facet_ranges.price.counts)
#set($start = $response.response.facet_counts.facet_ranges.price.start)
#set($end = $response.response.facet_counts.facet_ranges.price.end)
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facets.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facets.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facets.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/facets.vm Tue Oct 26 08:15:33 2010
@@ -1,15 +1,4 @@
- #if($response.facetFields)
- <h2>Facets</h2>
- #foreach($field in $response.facetFields)
- <span class="facet-field">$field.name</span>
-
- <ul>
- #foreach($facet in $field.values)
- <li><a href="#url_for_facet_filter($field.name, $facet.name)">$facet.name</a> ($facet.count)</li>
- #end
- </ul>
- #end
- #end
+#parse('facet_fields.vm')
#parse('facet_queries.vm')
#parse('facet_ranges.vm')
#parse('facet_dates.vm')
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/footer.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/footer.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/footer.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/footer.vm Tue Oct 26 08:15:33 2010
@@ -1,10 +1,17 @@
<hr/>
-Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a>
-
-#if($request.params.get('debugQuery'))
+<div>
+ <span>Options:</span>
+ #if($request.params.get('debugQuery'))
<a href="#url_for_home?#q#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end">disable debug</a>
-#else
+ #else
<a href="#url_for_lens&debugQuery=true">enable debug</a>
-#end
-
-<a href="#url_for_lens&wt=xml#if($request.params.get('debugQuery'))&debugQuery=true#end">XML</a>
\ No newline at end of file
+ #end
+ #if($annotate)
+ <a href="#url_for_home?#q#if($list.size($request.params.getParams('fq')) > 0)&#fqs($request.params.getParams('fq'))#end#boostPrice">disable annotation</a>
+ #else
+ <a href="#url_for_lens&annotateBrowse=true">enable annotation</a>
+ #end
+ <a #annTitle("Click to switch to an XML response: &wt=xml") href="#url_for_lens&wt=xml#if($request.params.get('debugQuery'))&debugQuery=true#end">XML</a></div>
+<div>Generated by <a href="http://wiki.apache.org/solr/VelocityResponseWriter">VelocityResponseWriter</a></div>
+<div><span>Documentation: </span> <a href="http://lucene.apache.org/solr">Solr Home Page</a>, <a href="http://wiki.apache.org/solr">Solr Wiki</a></div>
+<div>Disclaimer: The locations displayed in this demonstration are purely fictional. It is more than likely that no store with the items listed actually exists at that location!</div>
\ No newline at end of file
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/header.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/header.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/header.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/header.vm Tue Oct 26 08:15:33 2010
@@ -1 +1,3 @@
-## empty header, customize as desired
\ No newline at end of file
+<div id="head">
+ <span ><a href="#url_for_home#if($request.params.get('debugQuery'))?debugQuery=true#end"><img src="#{url_for_solr}/admin/solr_small.png" id="logo"/></a></span>
+</div>
\ No newline at end of file
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/hit.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/hit.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/hit.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/hit.vm Tue Oct 26 08:15:33 2010
@@ -1,6 +1,7 @@
+#set($docId = $doc.getFieldValue('id'))
#macro(field $f)
- #if($response.response.highlighting.get($doc.getFieldValue('id')).get($f).get(0))
- $!response.response.highlighting.get($doc.getFieldValue('id')).get($f).get(0)
+ #if($response.response.highlighting.get($docId).get($f).get(0))
+ $!response.response.highlighting.get($docId).get($f).get(0)
#else
#foreach($v in $doc.getFieldValues($f))
$v
@@ -8,11 +9,31 @@
#end
#end
<div class="result-document">
- <p><b>#field('name')</b></p>
- <p>Price: $!number.currency($doc.getFieldValue('price'))</p>
- <p>Features: #field('features')</p>
- <p>In Stock: #field('inStock')</p>
-
+ <div class="result-title"><b>#field('name')</b><span class="mlt">#if($params.getBool('mlt', false) == false)<a href="#lensNoQ&q=id:$docId&mlt=true">More Like This</a>#end</span></div>
+ ##do we have a physical store for this product
+ #set($store = $doc.getFieldValue('store'))
+ #if($store)<div class="map"><img src="http://maps.google.com/maps/api/staticmap?&zoom=12&size=150x80&maptype=roadmap&markers=$doc.getFieldValue('store')&sensor=false" /><div><small><a target="_map" href="http://maps.google.com/?q=$store&source=embed">Larger Map</a></small></div></div>#end
+ <div>Price: $!number.currency($doc.getFieldValue('price'))</div>
+ <div>Features: #field('features')</div>
+ <div>In Stock: #field('inStock')</div>
+ <div class="mlt">
+ #set($mlt = $mltResults.get($docId))
+ #set($mltOn = $params.getBool('mlt'))
+ #if($mltOn == true)<div class="field-name">Similar Items</div>#end
+ #if ($mltOn && $mlt && $mlt.size() > 0)
+ <ul>
+ #foreach($mltHit in $mlt)
+ #set($mltId = $mltHit.getFieldValue('id'))
+ <li><div><a href="#url_for_home?q=id:$mltId">$mltId</a></div><div><span class="field-name">Name:</span> $mltHit.getFieldValue('name')</div>
+ <div><span class="field-name">Price:</span> $!number.currency($mltHit.getFieldValue('price')) <span class="field-name">In Stock:</span> $mltHit.getFieldValue('inStock')</div>
+
+ </li>
+ #end
+ </ul>
+ #elseif($mltOn && $mlt.size() == 0)
+ <div>No Similar Items Found</div>
+ #end
+ </div>
#if($params.getBool("debugQuery",false))
<a href="#" onclick='jQuery(this).siblings("pre").toggle(); return false;'>toggle explain</a>
<pre style="display:none">$response.getExplainMap().get($doc.getFirstValue('id'))</pre>
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/layout.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/layout.vm?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/layout.vm (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/layout.vm Tue Oct 26 08:15:33 2010
@@ -25,10 +25,12 @@
// http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count
});
+
</script>
</head>
<body>
+ <div id="admin"><a href="#url_for_solr/admin">Solr Admin</a></div>
<div id="header">
#parse("header.vm")
</div>
Modified: lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/main.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/main.css?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/main.css (original)
+++ lucene/dev/branches/docvalues/solr/example/solr/conf/velocity/main.css Tue Oct 26 08:15:33 2010
@@ -1,3 +1,11 @@
+#admin{
+ text-align: right;
+ vertical-align: top;
+}
+
+#head{
+ width: 100%;
+}
.array-field {
border: 2px solid #474747;
background: #FFE9D8;
@@ -73,15 +81,16 @@ a {
background: white;
}
-#logo {
- margin: 10px;
- border-style: none;
-}
-
.constraints {
margin-top: 10px;
}
+#query-form{
+ width: 80%;
+}
+
+
+
.query-box, .constraints {
padding: 5px;
margin: 5px;
@@ -100,12 +109,11 @@ a {
}
.query-box {
- top: -35px;
- position: relative;
+
}
.query-boost {
- width: 20%;
+
top: 10px;
left: 50px;
position: relative;
@@ -116,12 +124,12 @@ a {
left: 180px;
top: -20px;
position: relative;
+
}
#logo {
- top: 35px;
- position: relative;
- margin-right: 50px;
+ margin: 10px;
+ border-style: none;
}
.pagination {
@@ -141,6 +149,24 @@ a {
margin-bottom: 15px;
}
+.result-document div{
+ padding: 5px;
+}
+
+.result-title{
+ width:60%;
+}
+
+.mlt{
+
+}
+
+.map{
+ float: right;
+ position: relative;
+ top: -25px;
+}
+
.result-document:nth-child(2n+1) {
background-color: #eee;
}
Propchange: lucene/dev/branches/docvalues/solr/lib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/lib:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/lib:967125-979432
-/lucene/dev/trunk/solr/lib:1021634-1025711
+/lucene/dev/trunk/solr/lib:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/lib:748824
/lucene/java/branches/lucene_2_9/solr/lib:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/lib:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/lib/commons-httpclient-3.1.jar
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,5 +1,5 @@
-/lucene/dev/branches/branch_3x/solr/lib/commons-httpclient-3.1.jar:949730,961612,979161,980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/solr/lib/commons-httpclient-3.1.jar:949730,961612,979161,980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/solr/lib/commons-httpclient-3.1.jar:967125-979432
-/lucene/dev/trunk/solr/lib/commons-httpclient-3.1.jar:1021634-1025711
+/lucene/dev/trunk/solr/lib/commons-httpclient-3.1.jar:1021634-1027393
/lucene/solr/branches/newtrunk/solr/lib/commons-httpclient-3.1.jar:924462
/lucene/solr/trunk/lib/commons-httpclient-3.1.jar:922950-923910,923912-925091
Propchange: lucene/dev/branches/docvalues/solr/lib/jcl-over-slf4j-1.5.5.jar
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,5 +1,5 @@
-/lucene/dev/branches/branch_3x/solr/lib/jcl-over-slf4j-1.5.5.jar:949730,961612,979161,980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/solr/lib/jcl-over-slf4j-1.5.5.jar:949730,961612,979161,980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/solr/lib/jcl-over-slf4j-1.5.5.jar:967125-979432
-/lucene/dev/trunk/solr/lib/jcl-over-slf4j-1.5.5.jar:1021634-1025711
+/lucene/dev/trunk/solr/lib/jcl-over-slf4j-1.5.5.jar:1021634-1027393
/lucene/solr/branches/newtrunk/solr/lib/jcl-over-slf4j-1.5.5.jar:924462
/lucene/solr/trunk/lib/jcl-over-slf4j-1.5.5.jar:922950-923910,923912-925091
Propchange: lucene/dev/branches/docvalues/solr/site/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/site:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/site:967125-979432
-/lucene/dev/trunk/solr/site:1021634-1025711
+/lucene/dev/trunk/solr/site:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/site:748824
/lucene/java/branches/lucene_2_9/solr/site:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/site:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/src/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,6 +1,6 @@
/lucene/dev/branches/branch_3x/solr/src:949730,961612,979161,980654,982195,987811,988512
/lucene/dev/branches/preflexfixes/solr/src:967125-979432
-/lucene/dev/trunk/solr/src:1021634-1025711
+/lucene/dev/trunk/solr/src:1021634-1027393
/lucene/java/branches/lucene_2_4/solr/src:748824
/lucene/java/branches/lucene_2_9/solr/src:817269-818600,825998,829134,829881,831036,896850,909334
/lucene/java/branches/lucene_2_9_back_compat_tests/solr/src:818601-821336
Propchange: lucene/dev/branches/docvalues/solr/src/common/org/apache/solr/common/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 26 08:15:33 2010
@@ -1,5 +1,5 @@
-/lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common:949730,961612,979161,980654,982195,987811,988512,1025544
+/lucene/dev/branches/branch_3x/solr/src/common/org/apache/solr/common:949730,961612,979161,980654,982195,987811,988512,1025544,1026614
/lucene/dev/branches/preflexfixes/solr/src/common/org/apache/solr/common:967125-979432
-/lucene/dev/trunk/solr/src/common/org/apache/solr/common:1021634-1025711
+/lucene/dev/trunk/solr/src/common/org/apache/solr/common:1021634-1027393
/lucene/solr/branches/newtrunk/solr/src/common/org/apache/solr/common:924462
/lucene/solr/trunk/src/common/org/apache/solr/common:922950-923910,923912-925091
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/cloud/SolrZkServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/cloud/SolrZkServer.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/cloud/SolrZkServer.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/cloud/SolrZkServer.java Tue Oct 26 08:15:33 2010
@@ -283,7 +283,7 @@ class SolrZkServerProps extends QuorumPe
// multiple matches... try to figure out by port.
for (QuorumPeer.QuorumServer server : slist.values()) {
if (server.addr.equals(thisAddr)) {
- if (clientPortAddress != null || clientPortAddress.getPort() <= 0)
+ if (clientPortAddress == null || clientPortAddress.getPort() <= 0)
setClientPort(server.addr.getPort() - 1);
return server.id;
}
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/CoreContainer.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/CoreContainer.java Tue Oct 26 08:15:33 2010
@@ -87,7 +87,7 @@ public class CoreContainer
private String zkHost;
{
- log.info("New CoreContainer: solrHome=" + solrHome + " instance="+System.identityHashCode(this));
+ log.info("New CoreContainer " + System.identityHashCode(this));
}
public CoreContainer() {
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/SolrCore.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/core/SolrCore.java Tue Oct 26 08:15:33 2010
@@ -367,12 +367,12 @@ public final class SolrCore implements S
void initIndex() {
try {
-
initDirectoryFactory();
- boolean indexExists = getDirectoryFactory().exists(getNewIndexDir());
+ String indexDir = getNewIndexDir();
+ boolean indexExists = getDirectoryFactory().exists(indexDir);
boolean firstTime;
synchronized (SolrCore.class) {
- firstTime = dirs.add(new File(getNewIndexDir()).getCanonicalPath());
+ firstTime = dirs.add(new File(indexDir).getCanonicalPath());
}
boolean removeLocks = solrConfig.unlockOnStartup;
@@ -381,10 +381,10 @@ public final class SolrCore implements S
if (indexExists && firstTime && removeLocks) {
// to remove locks, the directory must already exist... so we create it
// if it didn't exist already...
- Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), getDirectoryFactory(), solrConfig.mainIndexConfig);
+ Directory dir = SolrIndexWriter.getDirectory(indexDir, getDirectoryFactory(), solrConfig.mainIndexConfig);
if (dir != null) {
if (IndexWriter.isLocked(dir)) {
- log.warn(logid+"WARNING: Solr index directory '" + getIndexDir() + "' is locked. Unlocking...");
+ log.warn(logid+"WARNING: Solr index directory '" + indexDir+ "' is locked. Unlocking...");
IndexWriter.unlock(dir);
}
dir.close();
@@ -393,10 +393,10 @@ public final class SolrCore implements S
// Create the index if it doesn't exist.
if(!indexExists) {
- log.warn(logid+"Solr index directory '" + new File(getNewIndexDir()) + "' doesn't exist."
+ log.warn(logid+"Solr index directory '" + new File(indexDir) + "' doesn't exist."
+ " Creating new index...");
- SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex", getIndexDir(), getDirectoryFactory(), true, schema, solrConfig.mainIndexConfig, solrDelPolicy);
+ SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex", indexDir, getDirectoryFactory(), true, schema, solrConfig.mainIndexConfig, solrDelPolicy);
writer.close();
}
@@ -418,8 +418,9 @@ public final class SolrCore implements S
if (msg == null) msg = "SolrCore Object";
try {
clazz = getResourceLoader().findClass(className);
- if (cast != null && !cast.isAssignableFrom(clazz))
+ if (cast != null && !cast.isAssignableFrom(clazz)) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " is not a " +cast.getName());
+ }
//most of the classes do not have constructors which takes SolrCore argument. It is recommended to obtain SolrCore by implementing SolrCoreAware.
// So invariably always it will cause a NoSuchMethodException. So iterate though the list of available constructors
Constructor[] cons = clazz.getConstructors();
@@ -433,7 +434,7 @@ public final class SolrCore implements S
} catch (SolrException e) {
throw e;
} catch (Exception e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +cast.getName(), e);
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " failed to instantiate " +cast.getName(), e, false);
}
}
@@ -512,7 +513,6 @@ public final class SolrCore implements S
this.setName( name );
resourceLoader = config.getResourceLoader();
if (dataDir == null){
- // nocommit: why did solrconfig override core descriptor !?
if(cd.usingDefaultDataDir()) dataDir = config.getDataDir();
if(dataDir == null) dataDir = cd.getDataDir();
}
@@ -592,7 +592,7 @@ public final class SolrCore implements S
resourceLoader.inform( this ); // last call before the latch is released.
instance = this; // set singleton for backwards compatibility
} catch (IOException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e, false);
} finally {
// allow firstSearcher events to fire
latch.countDown();
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java Tue Oct 26 08:15:33 2010
@@ -866,6 +866,7 @@ class ExtendedDismaxQParser extends QPar
String val;
String val2;
boolean bool;
+ boolean bool2;
float flt;
int slop;
@@ -904,14 +905,15 @@ class ExtendedDismaxQParser extends QPar
}
@Override
- protected Query getRangeQuery(String field, String a, String b, boolean inclusive) throws ParseException {
+ protected Query getRangeQuery(String field, String a, String b, boolean startInclusive, boolean endInclusive) throws ParseException {
//System.out.println("getRangeQuery:");
this.type = QType.RANGE;
this.field = field;
this.val = a;
this.val2 = b;
- this.bool = inclusive;
+ this.bool = startInclusive;
+ this.bool2 = endInclusive;
return getAliasedQuery();
}
@@ -1022,7 +1024,7 @@ class ExtendedDismaxQParser extends QPar
case PREFIX: return super.getPrefixQuery(field, val);
case WILDCARD: return super.getWildcardQuery(field, val);
case FUZZY: return super.getFuzzyQuery(field, val, flt);
- case RANGE: return super.getRangeQuery(field, val, val2, bool);
+ case RANGE: return super.getRangeQuery(field, val, val2, bool, bool2);
}
return null;
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/SolrQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/SolrQueryParser.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/SolrQueryParser.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/SolrQueryParser.java Tue Oct 26 08:15:33 2010
@@ -130,6 +130,7 @@ public class SolrQueryParser extends Que
}
}
+ @Override
protected Query getFieldQuery(String field, String queryText, boolean quoted) throws ParseException {
checkNullField(field);
// intercept magic field name of "_" to use as a hook for our
@@ -161,15 +162,14 @@ public class SolrQueryParser extends Que
return super.getFieldQuery(field, queryText, quoted);
}
- protected Query getRangeQuery(String field, String part1, String part2, boolean inclusive) throws ParseException {
+ @Override
+ protected Query getRangeQuery(String field, String part1, String part2, boolean startInclusive, boolean endInclusive) throws ParseException {
checkNullField(field);
SchemaField sf = schema.getField(field);
- return sf.getType().getRangeQuery(parser, sf,
- "*".equals(part1) ? null : part1,
- "*".equals(part2) ? null : part2,
- inclusive, inclusive);
+ return sf.getType().getRangeQuery(parser, sf, part1, part2, startInclusive, endInclusive);
}
+ @Override
protected Query getPrefixQuery(String field, String termStr) throws ParseException {
checkNullField(field);
if (getLowercaseExpandedTerms()) {
@@ -191,6 +191,7 @@ public class SolrQueryParser extends Que
return prefixQuery;
}
+ @Override
protected Query getWildcardQuery(String field, String termStr) throws ParseException {
// *:* -> MatchAllDocsQuery
if ("*".equals(field) && "*".equals(termStr)) {
Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java?rev=1027396&r1=1027395&r2=1027396&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/JoinDocFreqValueSource.java Tue Oct 26 08:15:33 2010
@@ -24,6 +24,7 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.search.FieldCache.DocTerms;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.common.SolrException;
+import org.apache.solr.search.SolrIndexReader;
/**
* Use a field value and find the Document Frequency within another field.
@@ -45,19 +46,31 @@ public class JoinDocFreqValueSource exte
return NAME + "(" + field +":("+qfield+"))";
}
- public DocValues getValues(Map context, final IndexReader reader) throws IOException
+ public DocValues getValues(Map context, IndexReader reader) throws IOException
{
final DocTerms terms = cache.getTerms(reader, field, true );
+ int offset = 0;
+ IndexReader topReader = reader;
+ if (topReader instanceof SolrIndexReader) {
+ SolrIndexReader r = (SolrIndexReader)topReader;
+ while (r.getParent() != null) {
+ offset += r.getBase();
+ r = r.getParent();
+ }
+ topReader = r;
+ }
+ final IndexReader top = topReader;
+
return new DocValues() {
+ BytesRef ref = new BytesRef();
public int intVal(int doc)
{
try {
- BytesRef ref = new BytesRef();
terms.getTerm(doc, ref);
- int v = reader.docFreq( qfield, ref );
- //System.out.println( NAME+"["+ref.utf8ToString()+"="+v+"]" );
+ int v = top.docFreq( qfield, ref );
+ //System.out.println( NAME+"["+field+"="+ref.utf8ToString()+"=("+qfield+":"+v+")]" );
return v;
}
catch (IOException e) {