-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* BXC-4627 starting on tests * BXC-4627 updating manifest service * BXC-4627 update tests * BXC-4627 clean up * BXC-4627 updte logic, add unit test, account for edge cases * BXC-4627 simplify logic * BXC-4627 update return value * BXC-4627 update access copies service and move method up in iiif v3 manifest service * BXC-4627 undo access copies service changes * BXC-4627 moving code from access copies filter * BXC-4627 adding query filter * BXC-4627 update tests and search filters * BXC-4627 add new services to context * BXC-4627 add new AV filter * BXC-4627 more accurate naming * BXC-4627 update context * BXC-4627 cleanup * BXC-4627 use standard constants, update cross origin header in datastream controller * BXC-4627 add duration to main canvas element * BXC-4627 only set thumbnail section for images * BXC-4627 move thumbnail check to images only
- Loading branch information
1 parent
069dfbc
commit cccf211
Showing
8 changed files
with
545 additions
and
79 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
search-solr/src/main/java/edu/unc/lib/boxc/search/solr/filters/IIIFv3ViewableFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package edu.unc.lib.boxc.search.solr.filters; | ||
|
||
import edu.unc.lib.boxc.model.api.DatastreamType; | ||
import edu.unc.lib.boxc.search.api.SearchFieldKey; | ||
import edu.unc.lib.boxc.search.api.filters.QueryFilter; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Filter which restricts results to those with either JP2 access copy datastream or specified file types | ||
*/ | ||
public class IIIFv3ViewableFilter implements QueryFilter { | ||
private SearchFieldKey fieldKey; | ||
private List<String> fileTypes; | ||
|
||
protected IIIFv3ViewableFilter(List<String> fileTypes) { | ||
this.fileTypes = fileTypes; | ||
} | ||
@Override | ||
public String toFilterString() { | ||
var fileTypeField = SearchFieldKey.FILE_FORMAT_TYPE.getSolrField(); | ||
var fileTypeFilter = getFileTypes().stream().map( type -> fileTypeField + ":" + type) | ||
.collect(Collectors.joining(" OR ", "(", ")")); | ||
var datastreamFilter = SearchFieldKey.DATASTREAM.getSolrField() + ":" + DatastreamType.JP2_ACCESS_COPY.getId() + "|*"; | ||
return "(" + fileTypeFilter + ") OR (" + datastreamFilter + ")"; | ||
} | ||
|
||
@Override | ||
public SearchFieldKey getFieldKey() { | ||
return fieldKey; | ||
} | ||
|
||
public List<String> getFileTypes() { | ||
return fileTypes; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.