The Wayback Machine - https://web.archive.org/web/20230220232400/https://github.com/nextcloud/related_resources/
Skip to content

nextcloud/related_resources

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
October 28, 2022 18:52
css
July 4, 2022 17:45
js
December 12, 2022 18:08
lib
January 17, 2023 12:07
src
September 21, 2022 00:10
October 21, 2022 12:38
September 21, 2022 00:10
September 15, 2022 02:03
September 14, 2022 06:24
October 24, 2022 11:09
June 30, 2022 21:54
September 20, 2022 21:35
September 20, 2022 10:01
July 13, 2022 16:30
September 10, 2022 12:42

RelatedResources

Find all related resources linked to the current displayed item.
Related resources and displayed item can comes from multiple providers:

  • Files,
  • Deck,
  • Talk,
  • Calendar.

related resources

Based on currently displayed item from one of the available provider, the app:

  • get all entities that specific item is shared to,
  • get all resources from each provider shared to each entity,
  • filters results based on current user access rights,
  • weight each related resource using different rules:
    • in case of duplicated entry, only one will be kept and have its score improved,
    • compare keywords with the one from the displayed item to improve score,
    • improve score on shares generated in the same period of time,
    • compare the owner of the shares
    • in case of duplicate improvement, apply a diminishing return on the score improvement for each entry
    • decrease score in case of not-related shares
    • decrease score on old shares

building the app

$ make

app will be available in build/artifacts/

ocs

front-end will use this endpoint to get related resources to an item:

  • providerId can be files, deck, talk, calendar
  • itemId will be the unique Id to the current displayed item
curl "https://cloud.example.net/ocs/v2.php/apps/related_resources/related/<providerId>/<itemId>?format=json" -u 'user:password' -H "OCS-ApiRequest: true" -H "Accept: application/json"

occ

A command is available to get related resources from a terminal. The command will returns 2 tables displaying:

  • all shares' recipients to an item
  • list of related resources to the item
$ ./occ related:test <userId> <providerId> <itemId>
+---------------------------------+-----------+----------+--------+
| Single Id                       | User Type | User Id  | Source |
+---------------------------------+-----------+----------+--------+
| D2k2QudMQcwRl6s6Jv5XOviWGGmPnhQ | 16        | Test 001 | 16     |
| PSAM2DI1GwmyDydJSKdQxsaGPaNlVDD | 1         | test4    | 1      |
| v3RpXpyExROScJAEZvJLyHRt7Jsfk9J | 1         | test5    | 1      |
| IJCtfbJgIIMP96spf77lHPvLbWu6MZu | 1         | test6    | 1      |
+---------------------------------+-----------+----------+--------+

+-------------+---------+----------------+-------------+-------+-------------------------------------------------+
| Provider Id | Item Id | Title          | Description | Score | Link                                            |
+-------------+---------+----------------+-------------+-------+-------------------------------------------------+
| files       | 207     | /Test 001      | Files       | 3.528 | /index.php/f/207                                |
| files       | 16      | /Templates     | Files       | 1.1   | /index.php/f/16                                 |
| deck        | 3       | ouila          | Deck board  | 1     | http://nc24.local/index.php/apps/deck/#/board/3 |
| talk        | ad3jjo1 | Test Convo 001 | Talk Room   | 1     | http://nc24.local/index.php/call/amn2iar4       |
+-------------+---------+----------------+-------------+-------+-------------------------------------------------+

configuration

  • set the maximum number of result to be returned by the ocs endpoint
./occ config:app:set related_resources result_max --value 7

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages