Sign up Sign in Samples Blog contact support
Is a search card the only place you can put a search query?

Support Ticket

answered
 
+issue

Because my goal is this: Create a card that lists some static info and then lists results of a search. This would let me have a dynamically updating list of all the times a person is named in a particular plus card.

 

But if all searches have to be their own card first, I'd be adding a card to the site search results that's pretty useless to users just so I can make a card that's more useful to users.

 
+discussion

Yes, search queries only work in search cards. I'm not quite sure I understand what you're hoping to do here. If you want to add static content that appears above the results when people enter their own search terms, we don't have a way to do that. But if you want static content above a search that is always the same (or based on who is logged in, using _user) that we can do.

 

Assuming the latter, you're running into a general Wagn pattern. A similar question we get is whether we would add a way to have captions on images. Rather than make the Image cardtype more complicated (or in your case, making non-Search cardtypes more complicated by somehow allowing them to process WQL, the Wagn-y solution is to use Wagn's inclusion power to build what you're wanting out of multiple cards. So for captioned images, I'd create a new cardtype that had a structure with a +image and a +caption. In your situation, I'd make two cards:

 

FIRST CARD

 

[Static info that is always here...]

 

{{SECOND CARD}}

 

The second card would be a Search card showing "all the times a person is named in a particular plus card." (which is part of what I didn't quite understand.

 

Hope this is helpful.

--John Abbe.....2013-09-27 18:23:42 +0000

Yes, I know I can do it the second way. My concern is that means I'm creating a lot of junk cards that will show up in user searches just so I can construct something else out of them. Unless I can exclude a particular card from non-Admin search results? It's adding chaff.

 

The idea is this:

 

Every episode card I have has a +directed by card included. The name of the director is also a link. The link should take you to a card with some biographical data with a section that includes the search results for all +directed by cards that have his name, so you'd know which episodes he worked on.

--Lora Friedenthal.....2013-09-28 20:32:10 +0000

you need virtual cards

--Ethan McCutchen.....2013-09-28 23:46:49 +0000

Okay. That link doesn't describe how to make/use them. Is there a HowTo somewhere?

--Lora Friedenthal.....2013-09-28 23:50:30 +0000

I don't have much time this weekend, but I added some preliminary content on the virtual card page.

--Ethan McCutchen.....2013-09-29 00:07:00 +0000

Okay. I moved my questions to the discussion section there.

--Lora Friedenthal.....2013-09-29 01:12:40 +0000

This probably doesn't go here, but in plain English, if I want my search to be: Return all cards which contain either a "directed by" or "written by" plus card containing the same name as this current, sorted alphabetically, and listed as links, can I do that? I think it's the OR part that I'm not sure how to do, because I think the rest should look like (with some missing brackets so maybe the text will appear as text):

 

"plus": "directed by", {"content": _self}, "sort": "name", "view": "link"

--Lora Friedenthal.....2013-09-29 01:59:33 +0000

the "+directed by" cards should probably be [[Pointers]. if they are, you can do something like this:

 

{"right plus":["directed_by", {"refer_to":"_self"}], "sort":"name", "view":"link"}

--Ethan McCutchen.....2013-09-29 20:48:32 +0000

What if they're not pointers?

--Lora Friedenthal.....2013-09-29 21:02:27 +0000

The problem with using a pointer card is that in the labeled view, a pointer card doesn't have any separators between items, so names run together when they should have commas. But presumably if I actually add commas after each item, then the system will think the comma is part of the name of the card.

--Lora Friedenthal.....2013-09-29 22:06:57 +0000

Ethan, in that construction, how would I specify looking in two plus cards at the same time? directed by and written by?

--Lora Friedenthal.....2013-10-01 18:13:00 +0000

You can get a separator between pointer items with CSS, I forget the syntax for that right now but I know it's possible because I've done it in the past.

 

There is a trick that will let you look in two (but no more than two) plus cards, like so:

 

{"or": {"right plus":["directed_by", {"refer_to":"_self"}],

"plus":["written by", {"refer_to":"_self"}]

}

"sort":"name",

"view":"link"

}

--John Abbe.....2013-10-01 18:24:32 +0000

No results? JSON::ParserError :: 757: unexpected token at '{"or": {"right plus":["directed_by", {"refer_to":"_self"}], "plus":["written by", {"refer_to":"_self"}] } "sort":"name", "view":"link" }' :: {"or": {"right plus":["directed_by", {"refer_to":"_self"}], "plus":["written by", {"refer_to":"_self"}] } "sort":"name", "view":"link" }

--Lora Friedenthal.....2013-10-01 18:31:34 +0000

oops, "written by" should be "written_by"

--John Abbe.....2013-10-01 18:39:33 +0000

1. the "refer_to" syntax can be used any time there are links / inclusions. doesn't have to be with pointers.

2. the css trick john mentioned: http://www.w3schools.com/cssref/pr_gen_content.asp

3. you could fix john's syntax with a comma between the '}' and '"sort"'

4. however, it's cleaner to do this:

 

{"right_plus":[

{"name":["in","directed_by","written_by"]},

{"refer_to":"_self"}

],

"sort":"name",

"view":"link"

}

--Ethan McCutchen.....2013-10-01 18:41:32 +0000

(space in "written by" doesn't matter)

--Ethan McCutchen.....2013-10-01 18:42:02 +0000

Still gives the same error even with that correction.

 

No results? JSON::ParserError :: 757: unexpected token at '{"or": {"right plus":["directed_by", {"refer_to":"_self"}], "plus":["written_by", {"refer_to":"_self"}] } "sort":"name", "view":"link" }' :: {"or": {"right plus":["directed_by", {"refer_to":"_self"}], "plus":["written_by", {"refer_to":"_self"}] } "sort":"name", "view":"link" }

--Lora Friedenthal.....2013-10-01 18:42:45 +0000

:-P thx for finding my typo, and pointing out that usage of "in"!

--John Abbe.....2013-10-01 18:43:49 +0000

I ended up just adding spaces between the pointer list links, which works well enough for readability. But I'll bookmark that CSS page in case I want to try again.

--Lora Friedenthal.....2013-10-01 18:44:24 +0000

Hooray! Works. This feels very advanced. :-P Can "in" take any number of cards after it?

--Lora Friedenthal.....2013-10-01 18:46:34 +0000

yes

--John Abbe.....2013-10-01 18:47:58 +0000