Request for Modifications to Peertube Search in the video description or comments and Tag Limitations

I installed Peertube, but I found that the search feature cannot search in the video description or comments.
Additionally, when publishing a video, I can’t add more than 5 tags in the tags field.
How can I modify it to allow searching in the description and comments?
Also, how can I change it to accept more than 5 tags?

Hi,

Yes the search doesn’t take into account the description as it would require too much work for the database. I suggest to create a dedicated issue so we can discuss the implication of such feature in PeerTube: Sign in to GitHub · GitHub

For the comments it would not be scalable. And I don’t think youtube search into comments too, so can you describe your use case?

For the tags limit, please see Configurable tag limit · Issue #1815 · Chocobozzz/PeerTube · GitHub

I opened a topic to request a modification solution on GitHub a day ago:

Now . I want only search in Search in the video description

Please help me

1. Clone the PeerTube source code

cd /var/www
git clone https://github.com/Chocobozzz/PeerTube.git peertube-source
cd peertube-source
git checkout v7.1.1

2. Locate the search logic for videos

Edit the file:

server/core/models/video/sql/video/videos-id-list-query-builder.ts

Find the function that builds the search condition — it looks like this:

if (!search) {
  this.attributes.push('0 as similarity')
  return
}

const escapedSearch = this.sequelize.escape(search)
const escapedLikeSearch = this.sequelize.escape('%' + search + '%')

this.queryConfig = 'SET pg_trgm.word_similarity_threshold = 0.40;'

this.cte.push(
  '"trigramSearch" AS (' +
  '  SELECT "video"."id", ' +
  `  word_similarity(lower(immutable_unaccent(${escapedSearch})), lower(immutable_unaccent("video"."name"))) as similarity ` +
  '  FROM "video" ' +
  '  WHERE lower(immutable_unaccent(' + escapedSearch + ')) <% lower(immutable_unaccent("video"."name")) OR ' +
  '        lower(immutable_unaccent("video"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))' +
  ')'
)

3. Modify the search to include video descriptions

Change the search query by adding description field matching.

New modified block:

this.cte.push(
  '"trigramSearch" AS (' +
  '  SELECT "video"."id", ' +
  `  word_similarity(lower(immutable_unaccent(${escapedSearch})), lower(immutable_unaccent("video"."name"))) as similarity ` +
  '  FROM "video" ' +
  '  WHERE lower(immutable_unaccent(' + escapedSearch + ')) <% lower(immutable_unaccent("video"."name")) OR ' +
  '        lower(immutable_unaccent("video"."name")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + ')) OR ' +
  '        lower(immutable_unaccent("video"."description")) LIKE lower(immutable_unaccent(' + escapedLikeSearch + '))' +
  ')'
)

4. Build the project

yarn install
yarn build

This will recompile the modified PeerTube source code into the /dist folder.

5. Replace server files with the new build

cp /var/www/peertube-source/dist/core/models/video/sql/video/videos-id-list-query-builder.js /var/www/peertube/versions/peertube-v7.1.1/dist/core/models/video/sql/video/

sudo systemctl restart peertube

Now, when searching videos, PeerTube will match not only the video title, but also the description text!


Important Notes

  • This is a custom code modification — it will be lost if you upgrade PeerTube versions without reapplying the patch.
  • Ideally, for long-term support, you should build a small plugin or request this as a feature upstream.

Was there a definitive default or plugin solution to this discussion?