Skip to content

Commit

Permalink
Solr upgraded, fixed missing dependencies - few tests are still failing
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Mar 16, 2016
1 parent 381d0f6 commit 1f11168
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 27 deletions.
17 changes: 11 additions & 6 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<classpathentry kind="src" path="contrib/examples/src/test"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="con" path="build/solr-download/apache-solr-4.0.0-SVN/org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-test-framework-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="contrib/adsabs/lib/mongo-java-driver-2.11.3.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/test-framework/lib/ant-1.8.2.jar"/>
<classpathentry kind="lib" path="contrib/adsabs/lib/jython-standalone-2.7-b1.jar" sourcepath="contrib/adsabs/lib/jython-2.7-b1-sources.jar"/>
Expand Down Expand Up @@ -64,6 +65,11 @@
<classpathentry kind="lib" path="contrib/antlrqueryparser/lib/stringtemplate-3.2.1.jar"/>
<classpathentry kind="lib" path="contrib/antlrqueryparser/lib/antlr-3.4.jar"/>
<classpathentry kind="lib" path="contrib/antlrqueryparser/lib/antlr-runtime-3.4.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/example-lib/ext/jcl-over-slf4j-1.7.6.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/example-lib/ext/jul-to-slf4j-1.7.6.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/example-lib/ext/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/example-lib/ext/slf4j-api-1.7.6.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/example-lib/ext/slf4j-log4j12-1.7.6.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/apache-solr-49"/>
<classpathentry kind="lib" path="build/solrjars-extracted/antlr-runtime-3.5.jar"/>
Expand All @@ -79,7 +85,7 @@
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-benchmark-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-classification-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-codecs-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-core-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-core-4.9-SNAPSHOT.jar" sourcepath="/apache-solr-49/lucene"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-demo-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-expressions-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-facet-4.9-SNAPSHOT.jar"/>
Expand All @@ -89,24 +95,23 @@
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-memory-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-misc-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-queries-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-queryparser-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-queryparser-4.9-SNAPSHOT.jar" sourcepath="/apache-solr-49/lucene"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-replicator-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-sandbox-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-spatial-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-suggest-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/lucene-test-framework-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-analysis-extras-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-cell-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-clustering-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-core-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-core-4.9-SNAPSHOT.jar" sourcepath="/apache-solr-49/solr"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-dataimporthandler-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-dataimporthandler-extras-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-langid-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-map-reduce-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-morphlines-cell-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-morphlines-core-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-solrj-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-test-framework-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-solrj-4.9-SNAPSHOT.jar" sourcepath="/apache-solr-49/solr"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-test-framework-4.9-SNAPSHOT.jar" sourcepath="/apache-solr-49/solr"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-uima-4.9-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="build/solrjars-extracted/solr-velocity-4.9-SNAPSHOT.jar"/>
<classpathentry kind="output" path="bin"/>
Expand Down
1 change: 1 addition & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<name>apache-solr-48</name>
<comment></comment>
<projects>
<project>apache-solr-49</project>
</projects>
<buildSpec>
<buildCommand>
Expand Down
1 change: 1 addition & 0 deletions common-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
<fileset dir="${common.dir}/build">
<include name = "*solrjars-extracted/*.jar" />
<include name = "*solrjars-extracted/solrj-lib/*.jar" />
<include name = "*solrjars-extracted/example-lib/ext/*.jar" />
</fileset>
<!-- montysolr lib jars -->
<fileset dir="${common.dir}/lib">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@
*/

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

Expand All @@ -40,14 +35,13 @@
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.LowerCaseFilter;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.apache.lucene.analysis.synonym.SynonymFilter;
import org.apache.lucene.analysis.synonym.SynonymMap;
import org.apache.lucene.analysis.util.*;
import org.apache.lucene.analysis.util.ResourceLoader;
import org.apache.lucene.analysis.util.ResourceLoaderAware;
import org.apache.lucene.analysis.util.TokenFilterFactory;
import org.apache.lucene.analysis.util.TokenizerFactory;
import org.apache.lucene.util.AttributeFactory;
import org.apache.lucene.util.CharsRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.Version;
import org.apache.lucene.util.AttributeSource.AttributeFactory;
import org.apache.solr.common.util.StrUtils;

/**
* Factory for {@link SynonymFilter}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public void run(SolrQueryRequest req, BatchHandlerRequestQueue queue) throws Exc
int[][] data = it.next();
int[] references = data[0];
if (references != null && references.length > 0) {
uniqueValueCache.get(paperid, ret);
ret = uniqueValueCache.get(paperid);
out.write(ret.utf8ToString());
out.write("\t");
first=true;
for (int luceneDocId: references) {
uniqueValueCache.get(luceneDocId, ret);
ret = uniqueValueCache.get(luceneDocId);
if (ret.length > 0) {
if (!first) {
out.write("\t");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private List<String> getCitationValues(SolrDocument doc, int docid) {
if (citations[i] < 0) // unresolved refs = -1
continue;
if (idMapping != null) {
idMapping.get(citations[i], ret);
ret = idMapping.get(citations[i]);
data.add(ret.utf8ToString());
}
else {
Expand All @@ -181,7 +181,7 @@ private List<String> getReferenceValues(SolrDocument doc, int docid) {
if (references[i] < 0) // unresolved refs = -1
continue;
if (idMapping != null) {
idMapping.get(references[i], ret);
ret = idMapping.get(references[i]);
data.add(ret.utf8ToString());
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -1184,7 +1185,20 @@ protected List<Query> getQueries(Alias a) throws SyntaxError {
if (a.fields.size()==0) return null;
List<Query> lst= new ArrayList<>(4);

for (String f : a.fields.keySet()) {

// since the order of the fields is lost
// let's sort them alphabetically
List<String> fs = new ArrayList<String>(4);
fs.addAll(a.fields.keySet());
fs.sort(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
});


for (String f : fs) {
this.field = f;
Query sub = getAliasedQuery();
if (sub != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ private void unInvertedTheDamnThing(AtomicReader reader, Map<String,
i++;
continue;
}
idMapping.get(i, ret);
ret = idMapping.get(i);
if (ret.length > 0) {
setter.set(docBase, i, ret.utf8ToString()); // in this case, docbase will always be 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ public void testMultiTokens() throws Exception {


// ticket #318
assertQueryEquals(req("q", "creation of a thesaurus", "defType", "aqp", "qf", "title^1.4 all pub"),
"+(title:creation^1.4 | pub:creation | all:creation) +pub:of +pub:a +(title:thesaurus^1.4 | pub:thesaurus | all:thesaurus)",
assertQueryEquals(req("q", "creation of a thesaurus", "defType", "aqp", "qf", "all title^1.4 pub"),
"+(all:creation | pub:creation | title:creation^1.4) +pub:of +pub:a +(all:thesaurus | pub:thesaurus | title:thesaurus^1.4)",
BooleanQuery.class);
assertQ(req("q", "creation of a thesaurus", "defType", "aqp", "qf", "title^1.4 all pub"),
"//*[@numFound='1']",
Expand Down Expand Up @@ -395,7 +395,7 @@ public void testMultiTokens() throws Exception {

// lastly - unfielded phrase
assertQueryEquals(req("q", "\"modified newtonian dynamics\"", "defType", "aqp", "qf", "title^2.0 all^1.5"),
"((((title:\"modified newtonian dynamics\" (title:syn::acr::mond title:syn::modified newtonian dynamics)))^2.0) | (((all:\"modified newtonian dynamics\" (all:syn::acr::mond all:syn::modified newtonian dynamics)))^1.5))",
"((((all:\"modified newtonian dynamics\" (all:syn::acr::mond all:syn::modified newtonian dynamics)))^1.5) | (((title:\"modified newtonian dynamics\" (title:syn::acr::mond title:syn::modified newtonian dynamics)))^2.0))",
DisjunctionMaxQuery.class);
assertQ(req("q", "\"modified newtonian dynamics\"", "qf", "title^2.0 all^1.5"),
"//*[@numFound='2']",
Expand Down Expand Up @@ -527,7 +527,7 @@ public void testNoSynChain() throws Exception {
"//doc/str[@name='id'][.='4']"
);
//setDebug(true);
assertQueryEquals(req("q", "=\"Hubble Space Telescope\"", "defType", "aqp", "qf", "title body"),
assertQueryEquals(req("q", "=\"Hubble Space Telescope\"", "defType", "aqp", "qf", "body title"),
"(body:\"hubble space telescope\" | title:\"hubble space telescope\")",
DisjunctionMaxQuery.class);
}
Expand Down

0 comments on commit 1f11168

Please sign in to comment.