Hello all,

some user complained of the new way toolserver.namespacename handles cases in 
which the primary name of namespace is identical to the canonical name.
To fix this without breaking tools that rely on the new behavior, I add a new 
column "ns_is_favorite" to the table today (this solution was found with the 
help of valhallasw and Krinkle in IRC yesterday). The coloumn is a boolean 
field that describe if this ns_name is the best solution for a ns_id or not.

See the following examples:
mysql> SELECT ns_name,ns_type FROM namespacename WHERE 
domain="en.wikipedia.org" AND ns_id=4;
+-----------+-----------+
| ns_name   | ns_type   |
+-----------+-----------+
| Wikipedia | primary   |
| Project   | canonical |
| WP        | alias     |
+-----------+-----------+

mysql> SELECT ns_name,ns_type FROM namespacename WHERE 
domain="en.wikipedia.org" AND ns_id=4 AND ns_is_favorite=1;
+-----------+---------+
| ns_name   | ns_type |
+-----------+---------+
| Wikipedia | primary |
+-----------+---------+

mysql> SELECT ns_name,ns_type FROM namespacename WHERE 
domain="en.wikipedia.org" AND ns_id=2;
+---------+-----------+
| ns_name | ns_type   |
+---------+-----------+
| User    | canonical |
+---------+-----------+

mysql> SELECT ns_name,ns_type FROM namespacename WHERE 
domain="en.wikipedia.org" AND ns_id=2 AND ns_is_favorite=1;
+---------+-----------+
| ns_name | ns_type   |
+---------+-----------+
| User    | canonical |
+---------+-----------+

As you can see, if you use "ns_is_favorite=1" you will always get only 1 
result, no matter if there are primary and canonical or just a canonical one.

If you have questions or suggestions, please reply.

Sincerly,
DaB.


-- 
Userpage: [[:w:de:User:DaB.]] — PGP: 2B255885

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Reply via email to