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

Add differentiae_database and make differentia-related fields searchable #815

Merged
merged 5 commits into from
Jan 29, 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
1 change: 1 addition & 0 deletions app/public/cantusdata/helpers/chant_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def add_chant(self, row):
chant.genre = expandr.expand_genre(row["genre"].strip())
chant.mode = expandr.expand_mode(row["mode"].strip())
chant.differentia = expandr.expand_differentia(row["differentia"].strip())
chant.differentiae_database = row["differentiae_database"].strip()
chant.finalis = row["finalis"].strip()
chant.incipit = row["incipit"].strip()
chant.full_text = row["fulltext_standardized"].strip()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.7 on 2024-01-25 22:26

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cantusdata", "0002_remove_chant_concordances_delete_concordance"),
]

operations = [
migrations.AddField(
model_name="chant",
name="differentiae_database",
field=models.CharField(blank=True, max_length=15, null=True),
),
]
2 changes: 2 additions & 0 deletions app/public/cantusdata/models/chant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Meta:
lit_position = models.CharField(max_length=255, blank=True, null=True)
mode = models.CharField(max_length=255, blank=True, null=True)
differentia = models.CharField(max_length=255, blank=True, null=True)
differentiae_database = models.CharField(max_length=15, blank=True, null=True)
finalis = models.CharField(max_length=255, blank=True, null=True)
incipit = models.TextField(blank=True, null=True)
full_text = models.TextField(blank=True, null=True)
Expand Down Expand Up @@ -60,6 +61,7 @@ def create_solr_record(self):
"position": self.lit_position,
"mode": self.mode,
"differentia": self.differentia,
"differentiae_database": self.differentiae_database,
"finalis": self.finalis,
"incipit": self.incipit,
"full_text": self.full_text,
Expand Down
1 change: 1 addition & 0 deletions app/public/cantusdata/views/chant_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"position",
"mode",
"differentia",
"differentiae_database",
"finalis",
"incipit",
"full_text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<% if (differentia) { %>
<p><b>Differentia: </b> <%= differentia.replace('w', 'ω') %></p>
<% } %>
<% if (differentiae_database) { %>
<p><b>Differentiae Database: </b> <%= differentiae_database %></p>
<% } %>
Comment on lines +34 to +36

Choose a reason for hiding this comment

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

Not required before merging, but - I appreciate the indentation in these lines! It would really help readability if such indentation was applied to the rest of the file.

(also - what templating language is this? I'm confused by the javascripty parens-with-braces for conditionals, but wrapped in <% %>...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The template language is underscore's I believe (underscore is a dependency of marionette) <% ... %> executes the javascript code at ...

https://underscorejs.org/#template

<% if (finalis) { %>
<p><b>Finalis: </b> <%= finalis %></p>
<% } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ var KNOWN_FIELDS = [
{type: "mode", "name": "Mode"},
{type: "feast", "name": "Feast"},
{type: "genre", "name": "Genre"},
{type: "office", "name": "Office"}
{type: "office", "name": "Office"},
{type: "differentia", "name": "Differentia"},
{type: "differentiae_database", "name": "Differentiae Database"}
];

var INITIAL_LOAD_CUTOFF = 100;
Expand Down Expand Up @@ -53,7 +55,8 @@ export default Marionette.Object.extend({
"incipit",
"differentia",
"finalis",
"folio"
"folio",
"differentiae_database"
],

/**
Expand Down
4 changes: 4 additions & 0 deletions solr/solr/cantus_ultimus_1/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<field name="position" type="string" indexed="true" stored="true" multiValued="false" />
<field name="mode" type="string" indexed="true" stored="true" multiValued="false" />
<field name="differentia" type="string" indexed="true" stored="true" multiValued="false" />
<field name="differentiae_database" type="string" indexed="true" stored="true" multiValued="false" />
<field name="finalis" type="string" indexed="true" stored="true" multiValued="false" />
<field name="incipit" type="string" indexed="true" stored="true" multiValued="false" />
<field name="full_text" type="text_general" indexed="true" stored="true" multiValued="false" />
Expand Down Expand Up @@ -114,6 +115,8 @@
<copyField source="full_text_ms" dest="text" />
<copyField source="folio" dest="text" />
<copyField source="genre" dest="text" />
<copyField source="differentia" dest="text" />
<copyField source="differentiae_database" dest="text" />

<!-- Copy string fields we want to search by into dynamic text fields -->
<copyField source="feast" dest="feast_t_hidden" />
Expand All @@ -122,6 +125,7 @@
<copyField source="position" dest="position_t_hidden" />
<copyField source="mode" dest="mode_t_hidden" />
<copyField source="differentia" dest="differentia_t_hidden" />
<copyField source="differentiae_database" dest="differentiae_database_t_hidden" />
<copyField source="finalis" dest="finalis_t_hidden" />
<copyField source="folio" dest="folio_t_hidden" />
<copyField source="incipit" dest="incipit_t_hidden" />
Expand Down
Loading