The card *missing link both here and in my deck has the content '{"link_to":"_none"}', and it gives an error message as its content.
I created the search card Orphaned Cards in my deck with the content '{"referred_to_by":"_none"}' and it gave a similar error as its content. The end I hoped to achieve was to generate a list of cards neither linked from nor included in any other card, similar to the orphaned pages search built into MediaWiki and a few other wiki applications.
Although it's not documented, I gathered from *missing link that "_none" was once a valid contextual name.
Is a search like this supposed to work? If not, how do I search my deck for orphaned cards?
ActiveRecord::StatementInvalid :: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false) and t.trash is false ORDER BY t.updated_at desc LIMIT 20 )' at line 3: ( select t.name from cards t where t.id in (select referer_id from card_references where present = 0 AND ref_type='L' false) and t.trash is false ORDER BY t.updated_at desc LIMIT 20 ) :: {"link_to":"_none"}
ActiveRecord::StatementInvalid :: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'false) and t.trash is false ORDER BY t.updated_at desc LIMIT 20 )' at line 3: ( select t.name from cards t where t.id in (select referer_id from card_references where present = 0 AND ref_type='L' false) and t.trash is false ORDER BY t.updated_at desc LIMIT 20 ) :: {"referred_to_by":"_none"}
ooh, great timing, we're actually working on that code now.
So, to be absurdly obvious, that search isn't supposed to break! I may have accidentally fixed it last night, actually, because I'm optimizing some of the reference code. In any case, I'll definitely write a test for it and get it patched for 1.14.3.
However, that search is *not* a search for orphaned cards; it's a search for broken links. For example, if I create a card named "Food links" that contains a link to Houston veggies, but there is no card called Houston veggies, then the above search (when fixed) should return the Food links card.
The good news is that, while there is no built-in search for orphaned cards, it's not hard to create one. In most wiki systems, orphaned means "pages not linked to by other pages". Here is CQL to help you find that:
{"not":{"linked_to_by":{} } }
However, in Wagn, you might want not only cards not linked but also cards not nested (included) anywhere. You can find that like this:
{"not":{"referred_to_by":{} } }
A couple of qualifiers regarding "false" positives:
This is one reason why we don't included the orphaned search by default; it's easy to figure out what isn't linked to; it's harder to figure out what isn't playing a significant role in the system. You can likely find what you need with a little work by refining your query, but different folks are looking for "orphaned" cards for different reasons, so it's a little tricky to do one-size-fits-all here.
Thanks, and especially thanks for the proper syntax.
This popped into my mind regarding the last paragraph: Are there any starred cards that would be appropriate to consider orphaned, or any non-starred cards that wouldn't be considered orphaned? My impression was that starred cards are supposed to be treated as special system-management cards, so if that first question is no, then would it make sense to create search keywords that automatically exclude starred cards or exclude non-starred cards from their results?
Yep, you can definitely do that.
The following excludes both *star cards (simple cards beginning with a "*") and *rstar cards (those ending in +*something):
{ "not":{ "any":{ "referred_to_by":{}, "complete":"*", "right":{"complete":"*"} } } }
When I tried this on wagn.org I got over 5000 "orphaned cards" (including this support ticket, which isn't directly linked to anywhere in card content even though it's returned in a search on the support page), which is about a quarter of the cards on the site.
I could keep tweaking this to exclude tickets and such, of course. It's a process ;)
-e