diff --git a/.classpath b/.classpath index e79381794..71ab7f7e4 100644 --- a/.classpath +++ b/.classpath @@ -9,6 +9,7 @@ + @@ -64,6 +65,11 @@ + + + + + @@ -79,7 +85,7 @@ - + @@ -89,24 +95,23 @@ - + - - + - - + + diff --git a/.project b/.project index a2c40d3c0..bd8f2e231 100644 --- a/.project +++ b/.project @@ -3,6 +3,7 @@ apache-solr-48 + apache-solr-49 diff --git a/common-build.xml b/common-build.xml index a989cb7b8..8e5810e7e 100644 --- a/common-build.xml +++ b/common-build.xml @@ -255,6 +255,7 @@ + diff --git a/contrib/adsabs/src/java/org/apache/lucene/analysis/synonym/NewSynonymFilterFactory.java b/contrib/adsabs/src/java/org/apache/lucene/analysis/synonym/NewSynonymFilterFactory.java index 50e2d435b..7e6abddac 100644 --- a/contrib/adsabs/src/java/org/apache/lucene/analysis/synonym/NewSynonymFilterFactory.java +++ b/contrib/adsabs/src/java/org/apache/lucene/analysis/synonym/NewSynonymFilterFactory.java @@ -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; @@ -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}. diff --git a/contrib/adsabs/src/java/org/apache/solr/handler/batch/BatchProviderDumpCitationCache.java b/contrib/adsabs/src/java/org/apache/solr/handler/batch/BatchProviderDumpCitationCache.java index ca9b11b5e..3fe342b8b 100644 --- a/contrib/adsabs/src/java/org/apache/solr/handler/batch/BatchProviderDumpCitationCache.java +++ b/contrib/adsabs/src/java/org/apache/solr/handler/batch/BatchProviderDumpCitationCache.java @@ -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"); diff --git a/contrib/adsabs/src/java/org/apache/solr/response/transform/CitationsTransformerFactory.java b/contrib/adsabs/src/java/org/apache/solr/response/transform/CitationsTransformerFactory.java index d936dbc92..34d2ee205 100644 --- a/contrib/adsabs/src/java/org/apache/solr/response/transform/CitationsTransformerFactory.java +++ b/contrib/adsabs/src/java/org/apache/solr/response/transform/CitationsTransformerFactory.java @@ -160,7 +160,7 @@ private List 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 { @@ -181,7 +181,7 @@ private List 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 { diff --git a/contrib/adsabs/src/java/org/apache/solr/search/AqpExtendedDismaxQParserPlugin.java b/contrib/adsabs/src/java/org/apache/solr/search/AqpExtendedDismaxQParserPlugin.java index 08efd7acb..0fcb94370 100755 --- a/contrib/adsabs/src/java/org/apache/solr/search/AqpExtendedDismaxQParserPlugin.java +++ b/contrib/adsabs/src/java/org/apache/solr/search/AqpExtendedDismaxQParserPlugin.java @@ -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; @@ -1184,7 +1185,20 @@ protected List getQueries(Alias a) throws SyntaxError { if (a.fields.size()==0) return null; List lst= new ArrayList<>(4); - for (String f : a.fields.keySet()) { + + // since the order of the fields is lost + // let's sort them alphabetically + List fs = new ArrayList(4); + fs.addAll(a.fields.keySet()); + fs.sort(new Comparator() { + @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) { diff --git a/contrib/adsabs/src/java/org/apache/solr/search/CitationLRUCache.java b/contrib/adsabs/src/java/org/apache/solr/search/CitationLRUCache.java index ffe8a1683..d2bb1f3db 100644 --- a/contrib/adsabs/src/java/org/apache/solr/search/CitationLRUCache.java +++ b/contrib/adsabs/src/java/org/apache/solr/search/CitationLRUCache.java @@ -755,7 +755,7 @@ private void unInvertedTheDamnThing(AtomicReader reader, Map 0) { setter.set(docBase, i, ret.utf8ToString()); // in this case, docbase will always be 0 } diff --git a/contrib/adsabs/src/test/org/apache/solr/analysis/TestAdsabsTypeFulltextParsing.java b/contrib/adsabs/src/test/org/apache/solr/analysis/TestAdsabsTypeFulltextParsing.java index daed26bc5..afbf470d4 100644 --- a/contrib/adsabs/src/test/org/apache/solr/analysis/TestAdsabsTypeFulltextParsing.java +++ b/contrib/adsabs/src/test/org/apache/solr/analysis/TestAdsabsTypeFulltextParsing.java @@ -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']", @@ -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']", @@ -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); }