Browse Source

Merge branch 'master' into search-highlight-word

pull/588/head
Sebastian Meyer 2 years ago committed by GitHub
parent
commit
d4771b7308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      .github/ISSUE_TEMPLATE/task-for-the-development-fund.md
  2. 6
      Classes/Common/Solr.php
  3. 25
      Classes/Plugin/Search.php
  4. 2
      Configuration/ApacheSolr/configsets/dlf/conf/schema.xml
  5. 4
      Resources/Private/Language/Search.xml
  6. 2
      Resources/Public/Javascript/PageView/ImageManipulationControl.js
  7. 2
      Resources/Public/Javascript/PageView/PageView.js

18
.github/ISSUE_TEMPLATE/task-for-the-development-fund.md

@ -1,9 +1,9 @@
---
name: Task for the development fund
about: A working package which may be sponsored by the Kitodo e.V. development fund.
title: '[FUND] '
title: "[FUND] "
labels: development fund
assignees: ''
assignees: ""
---
@ -14,3 +14,17 @@ A clear and concise description of what should be developed.
## Related Issues
Please check if there are already any [issues](https://github.com/kitodo/kitodo-presentation/issues) related to this task and link them here using `#issuenumber`.
## Expected Benefits of this Development
Please try to explain who will benefit of this development (administrators, editors, users, sales, ...).
## Estimated Costs and Complexity
Please try to estimate the costs and / or the complexity of the development.
e.g.
* **low** ~ less than 5 working days
* **medium** ~ less than 10 working days
* **high** ~ more than 10 working days

6
Classes/Common/Solr.php

@ -366,12 +366,6 @@ class Solr
$params['filterquery'] = isset($params['filterquery']) ? $params['filterquery'] : [];
// Restrict the fields to the required ones.
$params['fields'] = 'uid,id';
// Extend filter query to get all documents with the same uids.
foreach ($params['filterquery'] as $key => $value) {
if (isset($value['query'])) {
$params['filterquery'][$key]['query'] = '{!join from=uid to=uid}' . $value['query'];
}
}
// Set filter query to just get toplevel documents.
$params['filterquery'][] = ['query' => 'toplevel:true'];
// Set join query to get all documents with the same uids.

25
Classes/Plugin/Search.php

@ -105,7 +105,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin
*
* @access protected
*
* @return string HTML input fields with current document's UID and parent ID
* @return string HTML input fields with current document's UID
*/
protected function addCurrentDocument()
{
@ -117,19 +117,25 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin
&& \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])
) {
$this->loadDocument();
// Get document's UID or parent ID.
// Get document's UID
if ($this->doc->ready) {
return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid) . '" />';
return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->uid) . '" />';
}
} elseif (!empty($list->metadata['options']['params']['filterquery'])) {
// Get document's UID from search metadata.
// The string may be e.g. "{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:2" OR {!join from=uid to=partof}uid:2 OR uid:2"
// or "collection_faceting:("Some Collection Title")"
foreach ($list->metadata['options']['params']['filterquery'] as $facet) {
$facetKeyVal = explode(':', $facet['query']);
if ($facetKeyVal[0] == 'uid') {
$documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')'));
if (($lastUidPos = strrpos($facet['query'], 'uid:')) !== false) {
$facetKeyVal = explode(':', substr($facet['query'], $lastUidPos));
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($facetKeyVal[1])) {
$documentId = (int) $facetKeyVal[1];
}
}
}
return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />';
if (!empty($documentId)) {
return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />';
}
}
return '';
}
@ -453,7 +459,10 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin
!empty($this->piVars['id'])
&& \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])
) {
$params['filterquery'][]['query'] = 'uid:(' . $this->piVars['id'] . ') OR partof:(' . $this->piVars['id'] . ')';
// Search in document and all subordinates (valid for up to three levels of hierarchy).
$params['filterquery'][]['query'] = '_query_:"{!join from=uid to=partof}uid:{!join from=uid to=partof}uid:' . $this->piVars['id'] . '"' .
' OR {!join from=uid to=partof}uid:' . $this->piVars['id'] .
' OR uid:' . $this->piVars['id'];
$label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id'])));
}
}

2
Configuration/ApacheSolr/configsets/dlf/conf/schema.xml

@ -107,7 +107,7 @@ limitations under the License.
<!-- Image number where this document starts. -->
<field name="page" type="int" indexed="false" stored="true" required="true" default="0" />
<!-- Unique identifier for the parent document in the TYPO3 database. Only if this is a multi-volume work! -->
<field name="partof" type="int" indexed="true" stored="true" required="true" default="0" />
<field name="partof" type="int" indexed="true" stored="true" required="true" default="0" docValues="true" />
<!-- Unique identifier for the root document in the TYPO3 database. Only if this is a multi-volume work! -->
<field name="root" type="int" indexed="true" stored="true" required="true" default="0" />
<!-- XML ID of this document in the METS file. This is only unique within the METS file! -->

4
Resources/Private/Language/Search.xml

@ -28,7 +28,7 @@
<label index="tt_content.pi_flexform.collections">Restrict search to these collections</label>
<label index="tt_content.pi_flexform.searchIn">Restrict search to current document or collection?</label>
<label index="tt_content.pi_flexform.searchIn.none">none</label>
<label index="tt_content.pi_flexform.searchIn.document">document only</label>
<label index="tt_content.pi_flexform.searchIn.document">document only (incl. subordinates)</label>
<label index="tt_content.pi_flexform.searchIn.collection">collection only</label>
<label index="tt_content.pi_flexform.searchIn.all">both</label>
<label index="tt_content.pi_flexform.facets">Show these facets</label>
@ -71,7 +71,7 @@
<label index="tt_content.pi_flexform.collections">Suche auf diese Kollektionen einschränken</label>
<label index="tt_content.pi_flexform.searchIn">Suche auf aktuelle/s Kollektion/Dokument einschränken?</label>
<label index="tt_content.pi_flexform.searchIn.none">nein</label>
<label index="tt_content.pi_flexform.searchIn.document">nur Dokument</label>
<label index="tt_content.pi_flexform.searchIn.document">nur Dokument (inkl. Unterordnungen)</label>
<label index="tt_content.pi_flexform.searchIn.collection">nur Kollektion</label>
<label index="tt_content.pi_flexform.searchIn.all">beides</label>
<label index="tt_content.pi_flexform.facets">Diese Facetten anzeigen</label>

2
Resources/Public/Javascript/PageView/ImageManipulationControl.js

@ -293,7 +293,7 @@ dlfViewerImageManipulationControl.prototype.createMap_ = function() {
new ol.interaction.PinchZoom(),
new ol.interaction.MouseWheelZoom(),
new ol.interaction.KeyboardPan(),
new ol.interaction.KeyboardZoom,
new ol.interaction.KeyboardZoom(),
new ol.interaction.DragRotateAndZoom()
],
// necessary for proper working of the keyboard events

2
Resources/Public/Javascript/PageView/PageView.js

@ -416,7 +416,7 @@ dlfViewer.prototype.init = function(controlNames) {
new ol.interaction.PinchZoom(),
new ol.interaction.MouseWheelZoom(),
new ol.interaction.KeyboardPan(),
new ol.interaction.KeyboardZoom,
new ol.interaction.KeyboardZoom(),
new ol.interaction.DragRotateAndZoom()
],
// necessary for proper working of the keyboard events

Loading…
Cancel
Save