Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into duplicateKeywords
Browse files Browse the repository at this point in the history
* upstream/main:
  disable conversions for empty fields (#9202)
  Update lucene version to 9.4 (#9213)
  Bump slf4j-api from 2.0.2 to 2.0.3 (#9207)
  Bump slf4j-api from 2.0.2 to 2.0.3 in /buildSrc (#9211)
  Add mappings on ModsImporter.java (#9193)
  • Loading branch information
Siedlerchr committed Oct 5, 2022
2 parents e032096 + e48ed0c commit c1da353
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- We disabled the conversion menu for empty fields [#9200](https://github.com/JabRef/jabref/issues/9200)
- We upgraded to Lucene 9.4 for the fulltext search.
Thus, the now created search index cannot be read from older versions of JabRef anylonger.
⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
[#9213](https://github.com/JabRef/jabref/pull/9213)
- Genres are now mapped correctly to entry types when importing MODS files. [#9185](https://github.com/JabRef/jabref/issues/9185)
- We improved the Citavi Importer to also import so called Knowledge-items into the field `comment` of the corresponding entry [#9025](https://github.com/JabRef/jabref/issues/9025)
- We removed wrapping of string constants when writing to a `.bib` file.
- We call backup files `.bak` and temporary writing files now `.sav`.
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ dependencies {
implementation 'org.apache.pdfbox:fontbox:3.0.0-RC1'
implementation 'org.apache.pdfbox:xmpbox:3.0.0-RC1'

implementation 'org.apache.lucene:lucene-core:9.3.0'
implementation 'org.apache.lucene:lucene-queryparser:9.3.0'
implementation 'org.apache.lucene:lucene-queries:9.3.0'
implementation 'org.apache.lucene:lucene-analysis-common:9.3.0'
implementation 'org.apache.lucene:lucene-highlighter:9.3.0'
implementation 'org.apache.lucene:lucene-core:9.4.0'
implementation 'org.apache.lucene:lucene-queryparser:9.4.0'
implementation 'org.apache.lucene:lucene-queries:9.4.0'
implementation 'org.apache.lucene:lucene-analysis-common:9.4.0'
implementation 'org.apache.lucene:lucene-highlighter:9.4.0'

implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.9.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
Expand Down Expand Up @@ -178,7 +178,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.15.3'
implementation 'com.konghq:unirest-java:3.13.11'

implementation 'org.slf4j:slf4j-api:2.0.2'
implementation 'org.slf4j:slf4j-api:2.0.3'
implementation "org.tinylog:tinylog-api:2.5.0"
implementation "org.tinylog:slf4j-tinylog:2.5.0"
implementation "org.tinylog:tinylog-impl:2.5.0"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {
dependencies {
implementation 'com.h2database:h2-mvstore:2.1.214'
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.slf4j:slf4j-api:2.0.2'
implementation 'org.slf4j:slf4j-api:2.0.3'
}

sourceSets{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
// fulltext search
requires org.apache.lucene.core;
// In case the version is updated, please also adapt SearchFieldConstants#VERSION to the newly used version
uses org.apache.lucene.codecs.lucene92.Lucene92Codec;
uses org.apache.lucene.codecs.lucene94.Lucene94Codec;

requires org.apache.lucene.queryparser;
uses org.apache.lucene.queryparser.classic.MultiFieldQueryParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.jabref.logic.cleanup.Formatter;
import org.jabref.logic.formatter.Formatters;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.strings.StringUtil;

import com.tobiasdiez.easybind.EasyBind;

public class DefaultMenu implements Supplier<List<MenuItem>> {

Expand Down Expand Up @@ -62,6 +65,7 @@ private static Menu getConversionMenu(TextInputControl textInputControl) {
CustomMenuItem menuItem = new CustomMenuItem(new Label(converter.getName()));
Tooltip toolTip = new Tooltip(converter.getDescription());
Tooltip.install(menuItem.getContent(), toolTip);
EasyBind.subscribe(textInputControl.textProperty(), value -> menuItem.setDisable(StringUtil.isNullOrEmpty(value)));
menuItem.setOnAction(event ->
textInputControl.textProperty().set(converter.format(textInputControl.textProperty().get())));
submenu.getItems().add(menuItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -167,7 +168,7 @@ private void parseModsGroup(Map<Field, String> fields, List<Object> modsGroup, B
abstractDefinition
.ifPresent(abstractDef -> putIfValueNotNull(fields, StandardField.ABSTRACT, abstractDef.getValue()));

genreDefinition.ifPresent(genre -> entry.setType(EntryTypeFactory.parse(genre.getValue())));
genreDefinition.ifPresent(genre -> entry.setType(EntryTypeFactory.parse(mapGenre(genre.getValue()))));

languageDefinition.ifPresent(
languageDef -> languageDef.getLanguageTerm().stream().map(LanguageTermDefinition::getValue)
Expand Down Expand Up @@ -203,6 +204,16 @@ private void parseModsGroup(Map<Field, String> fields, List<Object> modsGroup, B
putIfListIsNotEmpty(fields, notes, StandardField.NOTE, ", ");
}

private String mapGenre(String genre) {
return switch (genre.toLowerCase(Locale.ROOT)) {
case "conference publication" -> "proceedings";
case "database" -> "dataset";
case "yearbook", "handbook" -> "book";
case "law report or digest", "technical report", "reporting" -> "report";
default -> genre;
};
}

private void parseTitle(Map<Field, String> fields, List<Object> titleOrSubTitleOrPartNumber) {
for (Object object : titleOrSubTitleOrPartNumber) {
if (object instanceof JAXBElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class SearchFieldConstants {

public static final String[] PDF_FIELDS = new String[]{PATH, CONTENT, PAGE_NUMBER, MODIFIED, ANNOTATIONS};

public static final String VERSION = "lucene92";
public static final String VERSION = "lucene94";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@proceedings{TestPublication,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3"
xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd">
<mods version="3.3">
<genre authority="gmgpc">Conference Publication</genre>
<identifier type="citekey">TestPublication</identifier>
</mods>
</modsCollection>

0 comments on commit c1da353

Please sign in to comment.