What I need: To add custom field search functionality to OJS 3.4 without modifying the core code.
Describe the issue or problem: Consider custom fields in submissions, like those described in the tutorial: https://docs.pkp.sfu.ca/dev/plugin-guide/en/examples-custom-field. How can we enable searching for these custom fields within OJS?
I successfully added a new search filter to the UI by utilizing the Templates::Search::SearchResults::AdditionalFilters
hook to include the HTML for new fields. Additionally, I overrode the SearchHandler
class with a subclass to leverage the _assignSearchFilters
function.
However, the backend search functionality relies on specific functions that don’t utilize hooks. Modifying the OJS and PKP-LIB source code would be necessary to achieve this, which would involve changes to:
- ArticleSearch::getSearchFilters
- ArticleSearchDAO::getPhraseResults
- SearchHandler::search
Is my understanding correct so far?
Modifying the core code is undesirable because of the potential for conflicts during future updates. Therefore, I have the following questions:
- Are there alternative solutions to enable custom field search without core modifications?
- How can we contribute to making the code for custom field search more modular and beneficial to the community? (I’m open to creating a pull request, but I’m hesitant to invest time if it’s not in line with community needs.)
Finally, why aren’t search filters available for custom fields, similar to how they are for categories, sections, and issues on the submissions page?
What application are you using? OJS 3.4