Search & Files tag
Search
The search mechanism allows to quickly find existing entries in database, weather by looking for matching string or by tag applied to a file - that's why the file based modules contain possibility to save a tag for given document.
The logic behind this relies on:
- The action defined in the
SearchAction::getSearchResultsDataForTag
(since search relies on strings contained in provided tags)
tip
In order to extend the logic, all that has to be done is to extend search results by types:
- Repository which fetches the data used to apply searched strings/tags
FilesSearchRepository
tip
The most important thing is to extend the logic in method getSearchResultsDataForTag
by providing new type and the getSql
just like it's already done:
- The last thing to extend is the script
src/assets/scripts/core/ui/Search
tip
The first required thing is to extend the logic in buildSearchResults
, and the second one is to create a search builder
method like it's for example already done for files: buildFilesSearchResultsListElement
Files tags
The tagging mechanism has been designed strictly for files. This relies on:
selectize
- javascript plugin,FilesTagsAction::apiUpdateTags
- which receives file path and tags in form of strings from frontend,FilesTagsController::updateTags
- which passes the data further to the tagging serviceFileTagger
tip
To extend this logic up to any other files based module, all that is needed is an action calling/providing logic similar
to the one present in MyImagesAction::update
: