Skip to content

Commit

Permalink
Merge pull request #12 from ubtue/mtrojan
Browse files Browse the repository at this point in the history
VuFind 8.0.4
  • Loading branch information
mtrojan-ub authored Mar 30, 2022
2 parents 8fe2429 + 568b035 commit df55df9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions browse-handler/java/org/vufind/solr/handler/AuthDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Document getAuthorityRecord(String heading)
heading)),
1));

if (results.totalHits > 0) {
if (results.totalHits.value > 0) {
return searcher.getIndexReader().document(results.scoreDocs[0].doc);
} else {
return null;
Expand All @@ -77,7 +77,7 @@ public List<Document> getPreferredHeadings(String heading)

List<Document> result = new ArrayList<> ();

for (int i = 0; i < results.totalHits; i++) {
for (int i = 0; i < results.totalHits.value; i++) {
result.add(searcher.getIndexReader().document(results.scoreDocs[i].doc));
}

Expand Down
13 changes: 13 additions & 0 deletions browse-handler/java/org/vufind/solr/handler/BibDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.lucene.search.CollectionTerminatedException;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.SimpleCollector;
import org.apache.lucene.search.TermQuery;
Expand Down Expand Up @@ -133,6 +134,10 @@ public boolean needsScores() {
return false;
}

public ScoreMode scoreMode() {
return ScoreMode.COMPLETE_NO_SCORES;
}

public void doSetNextReader(LeafReaderContext context) {
this.context = context;
}
Expand Down Expand Up @@ -235,6 +240,10 @@ public boolean needsScores() {
return false;
}

public ScoreMode scoreMode() {
return ScoreMode.COMPLETE_NO_SCORES;
}

public void doSetNextReader(LeafReaderContext context) {
this.context = context;
}
Expand Down Expand Up @@ -339,6 +348,10 @@ public boolean needsScores() {
return false;
}

public ScoreMode scoreMode() {
return ScoreMode.COMPLETE_NO_SCORES;
}

public void doSetNextReader(LeafReaderContext context) {
this.context = context;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void setFields(Map<String, List<String>> fields)

public void setCount(int count)
{
this.setCount(new Integer(count));
this.setCount(Integer.valueOf(count));
}

public void setCount(Integer count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void init(@SuppressWarnings("rawtypes") NamedList args)
{
super.init(args);

solrParams = SolrParams.toSolrParams(args);
solrParams = args.toSolrParams();

authCoreName = solrParams.get("authCoreName", DFLT_AUTH_CORE_NAME);

Expand Down Expand Up @@ -91,7 +91,7 @@ private int asInt(String s)
{
int value;
try {
return new Integer(s).intValue();
return Integer.valueOf(s).intValue();
} catch (NumberFormatException e) {
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions browse-indexing/Leech.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private boolean termExists(String t)
} else {
q = new TermQuery (new Term (this.field, t));
}

return (this.searcher.search (new ConstantScoreQuery(q),
1).totalHits > 0);
1).totalHits.value > 0);
} catch (IOException e) {
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/org/vufind/solr/handler/BibDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import static org.junit.Assert.*;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
import org.apache.lucene.search.IndexSearcher;
import org.apache.solr.core.CoreContainer;
Expand Down Expand Up @@ -46,7 +48,7 @@ public static void setUpBeforeClass() throws Exception
Log.info("BibDBTest#setUpBeforeClass: %s = %s", solrHomeProp, System.getProperty(solrHomeProp));
// create the core container from the solr.home system property
Log.info("Loading Solr container...");
container = new CoreContainer();
container = new CoreContainer(Paths.get(System.getProperty(solrHomeProp)), new Properties());
container.load();
Log.info("Solr container loaded!");
bibCore = container.getCore("biblio");
Expand Down
4 changes: 3 additions & 1 deletion tests/org/vufind/solr/handler/tests/BrowseHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

import java.io.IOException;
import java.lang.System;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;

import org.apache.solr.client.solrj.SolrClient;
Expand Down Expand Up @@ -60,7 +62,7 @@ public static void prepareClass() throws Exception
System.out.println(solrHomeProp + "= " + System.getProperty(solrHomeProp));
// create the core container from the solr.home system property
logger.info("Loading Solr container...");
container = new CoreContainer();
container = new CoreContainer(Paths.get(System.getProperty(solrHomeProp)), new Properties());
container.load();
logger.info("Solr container loaded!");
authCore = container.getCore("authority");
Expand Down

0 comments on commit df55df9

Please sign in to comment.