Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuefind91 #15

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions browse-handler/java/org/vufind/solr/handler/AuthDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Map;

import org.apache.lucene.document.Document;
import org.apache.lucene.index.StoredFields;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
Expand Down Expand Up @@ -61,7 +62,7 @@ public Document getAuthorityRecord(String heading)
1));

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

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

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

return result;
Expand Down
4 changes: 2 additions & 2 deletions browse-handler/java/org/vufind/solr/handler/BibDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void collect(int docnum) {

int docid = docnum + context.docBase;
try {
Document doc = db.getIndexReader().document(docid);
Document doc = db.getIndexReader().storedFields().document(docid);
for (String bibField : bibExtras) {
String[] vals = doc.getValues(bibField);
if (vals.length > 0) {
Expand Down Expand Up @@ -367,7 +367,7 @@ public void collect(int docnum) {

int docid = docnum + context.docBase;
try {
Document doc = db.getIndexReader().document(docid);
Document doc = db.getIndexReader().storedFields().document(docid);
for (String bibField : bibExtras) {
for (String v : doc.getValues(bibField)) {
bibinfo.get(bibField).add(v);
Expand Down
3 changes: 2 additions & 1 deletion browse-indexing/PrintBrowseHeadings.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ private boolean isLinkedFromBibData(String heading)
}
}

StoredFields storedFields = authSearcher.getIndexReader().storedFields();
for (int i = 0; i < hits.scoreDocs.length; i++) {
Document doc = authSearcher.getIndexReader().document(hits.scoreDocs[i].doc);
Document doc = storedFields.document(hits.scoreDocs[i].doc);

String[] preferred = doc.getValues(System.getProperty("field.preferred", "preferred"));
if (preferred.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion browse-indexing/StoredFieldLeech.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public StoredFieldLeech (String indexPath, String field, String filter) throws E
private void loadDocument(IndexReader reader, int docid)
throws Exception
{
Document doc = reader.document(currentDoc, fieldSelection);
Document doc = reader.storedFields().document(currentDoc, fieldSelection);

String[] sort_key = doc.getValues (sortField);
String[] value = doc.getValues (valueField);
Expand Down
3 changes: 3 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<fileset erroronmissingdir="false" dir="${absolute.vufind.dir}/import/lib">
<include name="**/*.jar"/>
</fileset>
<fileset erroronmissingdir="false" dir="${absolute.vufind.dir}/import">
<include name="solrmarc_core_*.jar"/>
</fileset>
<!-- Needed for building tests that invoke Solr -->
<fileset erroronmissingdir="false" dir="${absolute.vufind.dir}/solr/vendor/server/lib">
<include name="**/*.jar"/>
Expand Down
18 changes: 18 additions & 0 deletions common/java/org/vufind/util/TitleNormalizer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.vufind.util;

import java.util.EnumSet;

import org.solrmarc.index.extractor.formatter.FieldFormatter;
import org.solrmarc.tools.DataUtil;

public class TitleNormalizer implements Normalizer
{
@Override
public byte[] normalize(String s)
{
EnumSet<FieldFormatter.eCleanVal> cleanValue = DataUtil.getCleanValForParam("titleSortLower");
String normalizedTitle = DataUtil.cleanByVal(s, cleanValue);
byte[] bytes = normalizedTitle == null ? null : normalizedTitle.getBytes();
return bytes;
}
}
Loading