Skip to content
Draft
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
7 changes: 6 additions & 1 deletion services/fin/models/collection/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
}
}
},


"@graph.datePublished" : {
"type" : "date",
"format": "yyyy-MM-dd||yyyy-MM||yyyy"
},

"@graph.yearPublished" : {
"type" : "integer"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,7 @@ export default class AppBrowseBy extends Mixin(LitElement)
if( sortBy.label === 'A-Z' ) {
sort = {"name" : "asc"};
} else if( sortBy.label === 'Recent' ) {
sort = [
{'@graph.yearPublished': {order : "desc" }},
{'@graph.lastModified': {order : "desc" }}
];
sort = config.elasticSearch.textFields.recentCollectionSortBy;
} else {
sort = {"@graph.itemCount" : "desc"};
}
Expand Down
9 changes: 8 additions & 1 deletion services/fin/ucd-lib-client/client/public/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ config.elasticSearch = {
// and update the overlay .env vars with the current working set of fields, until reindexing is done
textFields : {
record : APP_CONFIG.itemTextFields.split(',').map(f => f.trim()),
collection : APP_CONFIG.collectionTextFields.split(',').map(f => f.trim())
collection : APP_CONFIG.collectionTextFields.split(',').map(f => f.trim()),
recentCollectionSortBy : APP_CONFIG.recentCollectionsSortByFields.split(',').map(f => {
let parts = f.trim().split(':');
return {
[parts[0]]: { order: parts[1] || 'desc' }
};
})
},


// max number of facets filter options
maxFacetCount : 50
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const CollectionService = require('../services/CollectionService');
const RecordStore = require('../stores/RecordStore');
const AppStateModel = require('./AppStateModel');

const config = require('../config');

const {getLogger} = require('@ucd-lib/cork-app-utils');

class CollectionModel extends BaseModel {
Expand Down Expand Up @@ -110,10 +112,7 @@ class CollectionModel extends BaseModel {
// TODO: change to 'uploadDate'
let searchDocument = {
limit,
sort: [
{'@graph.yearPublished': {order : "desc" }},
{'@graph.lastModified': {order : "desc" }}
]
sort: config.elasticSearch.textFields.recentCollectionSortBy
};
// searchDocument = {limit: 3};
return this.search(searchDocument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class CollectionService extends BaseService {

searchDocument.textFields = config.elasticSearch.textFields.collection;
searchDocument.limit = 1000;

searchDocument['simple_query_string'] = true;

let id = await digest(searchDocument);

Expand Down
4 changes: 4 additions & 0 deletions services/fin/ucd-lib-client/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ config.client = {
itemTextFields : process.env.ITEM_TEXT_FIELDS || '@graph.text_search_description, name.punctuation_insensitive, name.stem, @graph.identifier, @graph.about, @graph.keywords, @graph.indexableContent',
collectionTextFields : process.env.COLLECTION_TEXT_FIELDS || '@graph.name.stem, @graph.description.stem, @graph.about.stem, @graph.keywords.stem',

// similar as textFields above, but for recent collections sorting on the home page and browse page
// field:sortOrder, comma-separated
recentCollectionsSortByFields : process.env.RECENT_COLLECTIONS_SORTBY_FIELDS || '@graph.datePublished:desc',

env : {
CLIENT_ENV : env,
FIN_APP_VERSION : process.env.FIN_APP_VERSION || '',
Expand Down
1 change: 1 addition & 0 deletions services/fin/ucd-lib-client/controllers/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = async (app) => {
featuredImages : config.client.featuredImages,
itemTextFields : config.client.itemTextFields,
collectionTextFields : config.client.collectionTextFields,
recentCollectionsSortByFields : config.client.recentCollectionsSortByFields,
env : config.client.env,
disableFileDownloads : config.gateway.proxy.disableFileDownloads,
downloadMirrorUrl : config.fcrepo.dataMirror.url,
Expand Down