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

Make Cantus ID searchable #853

Merged
merged 3 commits into from
May 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p>
<% } %>
<% if (cantus_id) { %>
<b>Cantus ID:</b> <%= cantus_id %>
<b>Cantus ID:</b> <a href = "https://cantusindex.org/id/<%= cantus_id %>" target = "_blank"><%= cantus_id %></a>
<% } %>
<% if (cdb_link_url) { %>
(<a href = <%= cdb_link_url %> target = "_blank" rel = "noopener noreferrer">Visit record in Cantus Database</a>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var KNOWN_FIELDS = [
{type: "genre", "name": "Genre"},
{type: "office", "name": "Office"},
{type: "differentia", "name": "Differentia"},
{type: "differentiae_database", "name": "Differentiae Database"}
{type: "differentiae_database", "name": "Differentiae Database"},
{type: "cantus_id", "name": "Cantus ID"},
];

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ export default Marionette.CompositeView.extend({

this.listenTo(this.searchParameters, 'change:sortBy change:reverseSort', this._triggerSortingChanged);
this.listenTo(this.searchParameters, 'change:query change:field', this._resetScrolling);

// Show manuscript column if additional fields requested in search
// includes the manuscript (in other words, if we are doing a
// cross-manuscript search)
this.showManuscript = _.some(this.getOption("infoFields"), field => field.type === 'manuscript');
},

childViewOptions: function ()
{
return {
searchType: this.searchParameters.get('field'),
query: this.searchParameters.get('query'),
infoFields: this.getOption('infoFields')
infoFields: this.getOption('infoFields'),
showManuscript: this.showManuscript
};
},

Expand Down Expand Up @@ -215,7 +221,8 @@ export default Marionette.CompositeView.extend({
templateHelpers: function()
{
return {
infoFields: _.toArray(this.getOption('infoFields'))
infoFields: _.toArray(this.getOption('infoFields')),
showManuscript: this.showManuscript
};
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default Marionette.ItemView.extend({

return {
infoFields: infoFields,
showManuscript: this.getOption('showManuscript'),
searchType: searchType,
result: this.model.getFormattedData(searchType, query),
isVolpianoSearch: searchType === 'volpiano' || searchType === 'volpiano_literal',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<table class="table table-condensed result-list child-container">
<thead>
<tr>
<% if (showManuscript) { %>
<th>
<a href="#">Manuscript</a>
<span class="search-caret"></span>
</th>
<% } %>
<th>
<a href="#">Folio</a>
<span class="search-caret"></span>
Expand All @@ -13,10 +19,12 @@
</th>

<% _.forEach(infoFields, function (field) { %>
<% if (field.type != 'manuscript') { %>
<th>
<a href="#"><%= field.name %></a>
<span class="search-caret"></span>
</th>
<% } %>
<% }); %>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<tr>
<% if (showManuscript) { %>
<td><%= result.manuscript %></td>
<% } %>

<td><%= result.folio %></td>

<td>
Expand All @@ -9,7 +13,9 @@
</td>

<% _.forEach(infoFields, function (field) { %>
<% if (field.type != 'manuscript') { %>
<td><%= result[field.type] %></td>
<% } %>
<% }); %>
</tr>

Expand Down
3 changes: 2 additions & 1 deletion solr/solr/cantus_ultimus_1/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<field name="folio_id" type="int" indexed="true" stored="true" />
<field name="image_uri" type="string" indexed="true" stored="true"/>
<field name="sequence" type="int" indexed="true" stored="true" />
<field name="cantus_id" type="text_general" indexed="true" stored="true" />
<field name="cantus_id" type="string" indexed="true" stored="true" />
<field name="cdb_uri" type="text_general" indexed="true" stored="true" />
<field name="feast" type="string" indexed="true" stored="true" />
<field name="feast_date" type="text_general" indexed="true" stored="true" multiValued="false" />
Expand Down Expand Up @@ -130,6 +130,7 @@
<copyField source="folio" dest="folio_t_hidden" />
<copyField source="incipit" dest="incipit_t_hidden" />
<copyField source="volpiano" dest="volpiano_literal" />
<copyField source="cantus_id" dest="cantus_id_t_hidden" />

<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" />
Expand Down
Loading