Page MenuHomePhabricator

RSS: Set guid from Cargo query to ensure it is unique
Closed, ResolvedPublicFeature

Description

Feature summary It would be good to be able to set the guid element from the Cargo query.

Alternatively it should be exactly the same as the url element:

  1. The url can be customised by the Cargo query.
  2. Currently the guid seems to be based on a URL based in turn on the title element, even if that title element has been modified by a CONCAT statement in the Cargo query, i.e. the guid isn't necessarily a working URL).

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution): See Benefits.

Benefits (why should this be implemented?): For some feeds the same wiki page might appear in more than one item, resulting in the guid not being unique at all. We need some way of ensuring it is unique.

See https://www.mediawiki.org/wiki/Extension_talk:Cargo#RSS:_Setting_guid (July 2023)

Event Timeline

You're right, at the moment it's assuming that _pageName is unique in the result set — but are you saying that sometimes you're providing that and it isn't an existing page? Could you add your full #cargo_query call here?

The FeedItem class sets the unique ID to url, and then we're changing it to the permalink.

Perhaps you're right, and the simplest thing here is to add e.g. unique_id to the possible result fields, and then use whatever it is.

(Also, I'm not sure what the relevance is of the linked discussion about removing unwanted commas.)

Change 942724 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/Cargo@master] Allow feed display format to override 'unique_id'

https://gerrit.wikimedia.org/r/942724

but are you saying that sometimes you're providing that and it isn't an existing page

Here's the relevant part: |fields=CONCAT("Some text here. ", Tablename._pageName, ". ")=_pageName. So when you add http://wiki... to that you don't get a URL that works.

The principle I suppose is that the feed title might be the wiki page name, might include it, or might be something completely different.

I'm not sure what the relevance is of the linked discussion about removing unwanted commas

My mistake. I've changed that to the relevant talk page link.

[mediawiki/extensions/Cargo@master] Allow feed display format to override 'unique_id'

That looks great.

Change 942724 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Allow feed display format to override 'id'

https://gerrit.wikimedia.org/r/942724

Yaron_Koren subscribed.

This is done, I assume...