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

Feature/lxl 4149 title filters #1293

Merged
merged 5 commits into from
Sep 8, 2023
Merged
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
10 changes: 8 additions & 2 deletions librisworks/src/main/groovy/se/kb/libris/mergeworks/Doc.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Doc {
}

boolean hasGenericTitle() {
Util.hasGenericTitle(instanceTitle())
Util.hasGenericTitle(instanceTitle()) || Util.hasGenericTitle(workTitle())
}

boolean isMonograph() {
Expand All @@ -209,7 +209,13 @@ class Doc {

boolean hasPart() {
workData['hasPart'] || instanceData['hasTitle'].findAll { it['@type'] == 'Title' }.any {
it.hasPart?.size() > 1 || it.hasPart?.any { p -> asList(p.partName).size() > 1 || asList(p.partNumber).size() > 1 }
it.hasPart?.size() > 1
|| it.hasPart?.any { p -> asList(p.partName).size() > 1
|| asList(p.partNumber).size() > 1 }
// space+semicolon indicates an aggregate if it is not preceded by a slash
// aggregate: Måsen ; Onkel Vanja ; Körsbärsträdgården
// not aggregate: En visa för de döda / Patrick Dunne ; översättning: Hans Lindeberg
|| [it.mainTitle, it.titleRemainder, it.subtitle].findAll().toString() =~ /(?<!\/.+)(\s+;)/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why \/ in the regexp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We allow semicolon when it's preceded by a slash (not aggregate).

kwahlin marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down