Overview

IIIF Search is a module for Omeka S that adds a IIIF Search API for full-text search.

https://github.com/symac/Omeka-S-module-IiifSearch

This time, I modified the above module. A pull request has been submitted, but the modified module is available in the following repository.

https://github.com/nakamura196/Omeka-S-module-IiifSearch

Specifically, the minimum query string length was set to 1 character, but I made it configurable through a settings form. The default was set to 3 characters, which prevented searching with a single kanji character, so this modification was made.

Modification Details

The following four files were modified.

  • config/module.ini
  • src/Form/ConfigForm.php
  • Module.php
  • src/View/Helper/IiifSearch.php

config/module.ini

https://github.com/nakamura196/Omeka-S-module-IiifSearch/commit/d2707361d9aa038c3f7da2db559051386f15e222#diff-a3f073087bb51946398c23263f05539c4d57e12b198f9ba0a0887b0a2e9f710b

I changed configurable to true. This causes the following settings screen to be displayed after module installation.

src/Form/ConfigForm.php

https://github.com/nakamura196/Omeka-S-module-IiifSearch/commit/d2707361d9aa038c3f7da2db559051386f15e222#diff-8535197317d24c4a15681f0ba9fa1e762040d2e3984f5d1981471092a4946f74

The display content on the above settings screen is achieved by editing src/Form/ConfigForm.php.

A configuration value for iiifsearch_minimum_query_length has been added.

Module.php

https://github.com/nakamura196/Omeka-S-module-IiifSearch/commit/d2707361d9aa038c3f7da2db559051386f15e222#diff-074f64cd19bc13bc527290951a58a65cb54f2f35a43ce5bf95e5dbb20b4d297d

The settings for the above screen are implemented by modifying Module.php.

Specifically, the getConfigForm and handleConfigForm forms have been added.

Additionally, install and uninstall functions have been added to configure processing during module installation and uninstallation, handling the initial value setting and deletion of iiifsearch_minimum_query_length.

src/View/Helper/IiifSearch.php

https://github.com/nakamura196/Omeka-S-module-IiifSearch/commit/d2707361d9aa038c3f7da2db559051386f15e222#diff-130dd3b86192225df59328df92c2bed1f2b2de8ba3f561946e2dcfcb5da7d8b8

Finally, src/View/Helper/IiifSearch.php is modified. Where minimumQueryLength was previously set to 3, the configuration value is now read using $this->view->setting('iiifsearch_minimum_query_length') and used as the value for minimumQueryLength. This means that, for example, when dealing with Japanese text, setting minimumQueryLength to 1 in the settings screen enables searching from a single character.

Summary

I hope this serves as a useful reference when using this module, particularly for searching Japanese text. I also hope it serves as a reference for Omeka S module development.