diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c29a663c2b..26e4ebbf307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We updated updated the Related Articles tab to accept JSON from the new version of the Mr. DLib service - We added an option in the preference dialog box that allows user to choose behavior after dragging and dropping files in Entry Editor. [#4356](https://github.com/JabRef/jabref/issues/4356) - We added the ability to have an export preference where previously "File"-->"Export"/"Export selected entries" would not save the user's preference[#4495](https://github.com/JabRef/jabref/issues/4495) +- For automatically created groups, added ability to filter groups by entry type. [#4539](https://github.com/JabRef/jabref/issues/4539) - We added the ability to add field names from the Preferences Dialog [#4546](https://github.com/JabRef/jabref/issues/4546) - We added the ability change the column widths directly in the main table. [#4546](https://github.com/JabRef/jabref/issues/4546) - We added the ability to execute default action in dialog by using with Ctrl + Enter combination [#4496](https://github.com/JabRef/jabref/issues/4496) diff --git a/src/main/java/org/jabref/model/entry/BibEntry.java b/src/main/java/org/jabref/model/entry/BibEntry.java index bfd5182bd11..4e133b759cf 100644 --- a/src/main/java/org/jabref/model/entry/BibEntry.java +++ b/src/main/java/org/jabref/model/entry/BibEntry.java @@ -792,7 +792,7 @@ private void invalidateFieldCache(String fieldName) { } public Optional getLatexFreeField(String name) { - if (!hasField(name)) { + if (!hasField(name) && !TYPE_HEADER.equals(name)) { return Optional.empty(); } else if (latexFreeFields.containsKey(name)) { return Optional.ofNullable(latexFreeFields.get(toLowerCase(name))); @@ -801,6 +801,15 @@ public Optional getLatexFreeField(String name) { Optional citeKey = getCiteKeyOptional(); latexFreeFields.put(name, citeKey.get()); return citeKey; + } else if (TYPE_HEADER.equals(name)) { + Optional entryType = EntryTypes.getType(getType(), BibDatabaseMode.BIBLATEX); + if (entryType.isPresent()) { + String entryName = entryType.get().getName(); + latexFreeFields.put(name, entryName); + return Optional.of(entryName); + } else { + return Optional.of(StringUtil.capitalizeFirst(getType())); + } } else { String latexFreeField = LatexToUnicodeAdapter.format(getField(name).get()).intern(); latexFreeFields.put(name, latexFreeField); diff --git a/src/main/java/org/jabref/model/groups/WordKeywordGroup.java b/src/main/java/org/jabref/model/groups/WordKeywordGroup.java index 5353f8e65af..35a5912c332 100644 --- a/src/main/java/org/jabref/model/groups/WordKeywordGroup.java +++ b/src/main/java/org/jabref/model/groups/WordKeywordGroup.java @@ -6,10 +6,15 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.Set; +import java.util.stream.Collectors; +import org.jabref.model.EntryTypes; import org.jabref.model.FieldChange; +import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.EntryType; import org.jabref.model.entry.KeywordList; import org.jabref.model.strings.StringUtil; @@ -113,6 +118,12 @@ public boolean contains(BibEntry entry) { private Set getFieldContentAsWords(BibEntry entry) { if (onlySplitWordsAtSeparator) { + if (BibEntry.TYPE_HEADER.equals(searchField)) { + Optional entryType = EntryTypes.getType(entry.getType(), BibDatabaseMode.BIBLATEX); + if (entryType.isPresent()) { + return searchWords.stream().filter(sw -> entryType.get().getName().equals(sw)).collect(Collectors.toSet()); + } + } return entry.getField(searchField) .map(content -> KeywordList.parse(content, keywordSeparator).toStringList()) .orElse(Collections.emptySet());