Bear With Me: Advanced Search

Bear inside Tree

One of the inevitable truths of Living Card Games is that deck building becomes more difficult as the game grows. With an expanded card pool, there are so many cards to choose from, and unless you plan on building 70 card decks, there just is not enough room for every card that you want to play. For even the sharpest bear, we can find ourselves scratching our skulls, trying to remember that perfect card to round out our new shiny deck.

The need for an up to date and accurate search engine was the entire reason that I created The Hall of Beorn Card Search. But I am not a bear that it content to just sit still. One of the most requested features for the search engine has been for the ability to use multiple of the same filter. For example: what are all of the 2 cost allies from either the Spirit or Tactics sphere. Having made software for many years now, I have seen many dynamic query interfaces. There is one word that I would use to describe many of these interfaces: clunky.

At some point, I would love to create an elegant user interface to help users easily create searches with multiple filters and complex logic. With limited time to spend adding features to the card search, it does not make sense for me to spend hours and hours crafting the perfect advanced search interface – especially if not many users end up taking advantage of this feature. In the mean time, I have decided to provide the advanced search features that people have asked for, but leave the user interface alone.

The easiest way to do this was to define a special syntax for advanced searches, and update the search engine to check for searches that match this new syntax. Up until now, the search field has only been used to provide a string to match against the title and game text of each card. For example: searching for “Aragorn” will not only return the two hero cards with that title, but other cards that refer to him by name – his many attachments.

With the latest version, you can still use the search field for these types of basic search. In addition, you can use two special characters: “+” and “-“, to perform advanced searches. It is important to emphasize that advanced search in no way changes the preexisting functionality of card search. All of the filters that you select from drop down menus still work as expected. The best way to think of advanced search is another tool, that you can use in addition to the basic search features, to further refine your search.

bearbirdfeederThe “+” is used to include a filter in your search, but it supports multiple values. So if you want to filter by Sphere, but you need to include more than one sphere in your search, you can include “+sphere:Leadership,Lore” in the search box. Logically any advanced search criteria is added (or ANDED, for those familiar with Boolean Algebra) to the existing basic search. This means anything you enter into basic search drop downs must be true, in addition to any advanced search filters.

So if you were to select Spirit from the sphere drop down menu, then enter an advanced search of “+sphere:Leadership,Lore”, you would get no results. This is because no card has both the Spirit printed sphere AND the Leadership or Lore printed sphere. In short, if you want to search for a given filter by multiple values, stick to advanced search and do not use the basic search filter of the same type. You can still mix and match basic and advanced filters of different types and it works as you would expect. For example selecting “Ally” from the card type drop down menu, then adding a search field of “rcost:2,3,5” would return all allies with a resource cost of 2 or 3 or 5.

The “-” adds a filter, just the like “+” character, and also supports multiple values just like it’s less pessimistic brother. The difference is that the “-” character indicates a negated filter. For example, what if you want to search for all cards with the text “Aragorn”, except for those with the Spirit sphere. The advanced search  “Aragorn -sphere:Spirit” will give you just that. So let’s combine a few of these examples together into a more complex query. Let’s say that we want all Spirit or Tactics allies or attachments that cost between 2 and 4 resources, but don’t have the “Dwarf”, “Weapon” or “Armor” traits. Here is that search: “+sphere:Spirit,Tactics +type:Ally,Attachment -trait:Dwarf,Weapon,Armor”.

It should also be pointed out that advanced search is case insensitive, so the following search is equivalent to the one above: “+sphere:spirit,tactics +type:ally,attachment -trait:dwarf,weapon,armor”. In the case of traits, keywords, and especially card sets, some of them can be rather long – which makes them cumbersome to type and far too easy to misspell. To aid with filtering these fields, advanced search supports the “*” character as a “wild card”. For example “cycle:*shadow*” would give you cards from both the Shadows of Mirkwood cycle and the Against the Shadow cycle. Likewise “+set:the_hills*” would match The Hills of Emyn Muil, so that you don’t have to type out such a long name.

This latest example also highlights a limitation of advanced search. If you want to search for something with a space (e.g. “The Hills of Emyn Muil”), you need to use a “_” character instead of any spaces. This is because the search sees any text that does not start with a “+” or a “-” as a normal search. So if you entered a search of “+set:The Hills*” the search engine would see this as two separate things. First it would add a filter for any set named “The”, then it would do a search for all cards for the text “Hills*”. Since there is neither a set named “The”, nor any cards which contain the actual text “Hills*”, this search would return no results. So just remember, if you need to do an advanced search with a value that contains strings, the “_” character is your friend.

Now this is a whole lot of complex gibberish, and it can make one’s head swim. As a bear, I prefer concrete examples to abstract theory. I can’t eat an abstraction. So here is one last example to tie everything together:

+trait:silvan,noldor +type:ally +cycle:shadow*,*dwar*,again* -rcost:5

This returns all Silvan or Noldor allies from the first three cycles of the game that do not cost 5 resources (sorry Gildor). You can test this fancy search out right here. Because all searches in Hall of Beorn card search are represented as URLs, it is easy to share your advanced searches with others, simply copy and paste the link. So head on over to the newly updated card search, and try out some advanced search goodness. This is a complex subject, and bears are not always the best creatures to explain such wonders (sadly, no wizards were available to write this post), so feel free to ask questions in the comments below.

Without further ado, here are the available filters supported by advanced search.

Filter Description Example Values
cycle Card Cycle Shadows of Mirkwood, Dwarrowdelf, Against*, gencon
set Card Set The_Dead_Marshes, *dunland*,
type Card Type hero,ally,attachment,enemy,treachery,objective-ally
sphere Sphere of Influence leadership,tactics,spirit,lore,baggins,fellowship
rcost Resource Cost 1,2,3,4,5,6
tcost Threat Cost 5,9,11,12
ecost Engagement Cost 20,25,32,50
threat Enemy Threat 1,2,3,4,5
wp Willpower 0,2,3,4
atk Attack 1,2,3,5,7
def Defense 0,1,2,4
hp Hit Points 1,2,5,10
trait Card Trait dwarf,orc,silvan,noldor,weapon,condition,item,naz*
keyword Card Keyword ranged,sentinel,*immune*,*cannot_have*
encounter Encounter Set sauron*,*mountain*
artist Artist magali*,ben_z*
category Category healing,direct_damage,encounter_scrying
victory Victory Points 1,2,3,4,5
Advertisements
This entry was posted in Community, Deck Building, Hall of Beorn Card Search, Software and tagged , , , , , , . Bookmark the permalink.

11 Responses to Bear With Me: Advanced Search

  1. Pekka says:

    That’s really handy! Having said that, I happened to stumble onto something I don’t quite understand. Is there a reason why this query returns only two cards? http://hallofbeorn.com/Cards/Search?Query=%2Btrait%3Aeagle There are many other eagles, after all, and you can find them using the Trait dropdown selector.

    And your Hobbit Pipe seems to be missing a very important trait: http://hallofbeorn.com/Cards/Details/Hobbit-Pipe-TBR

    • Beorn says:

      Good catch. I will get the Pipe trait added to Hobbit Pipe tomorrow. As for the eagle query, I am genuinely puzzled why that is not returning all of the eagles. At least the basic trait filter works while I figure it out. I knew that advanced search would have some rough edges, so appreciate your help in identifying them.

    • Beorn says:

      It appears that the Eagle trait has a leading space on most of the eagle cards (except the two that you mentioned). I will clean up these spaces, but in the mean time the following query will work: +trait:*eagle

  2. Robin Munn says:

    Awesome feature! One thing I’d like to see is being able to specify a range of costs (of whatever kind: threat, engagement, etc). A hyphen would make the most sense, and if it’s in the middle of a search term, it shouldn’t cause confusion with the + or – at the start of an advanced search. I’d also like to see “costs less than 3” or “has engagement cost greater than 25”, but you could do that with ranges too, e.g.:

    +rcost:2-4 for resource cost between 2 and 4 (inclusive)
    +rcost:-3 for resource cost up to 3
    +rcost:3- for resource cost of 3 or higher

    +ecost:-25 for engagement cost up to 25
    +ecost:26- for engagement cost of 26 or higher
    +ecost:37-42 for engagement cost between 37 and 42 (inclusive)

    Especially in the realm of engagement cost, if I want to check just which enemies will be able to engage my Secrecy deck right from the start, I don’t want to have to type “+ecost:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20”. I would MUCH rather be able to just type “+ecost:-20” and have that work.

    Isn’t that typical? I wouldn’t have thought of this before you added this very nice feature, but now that it’s there, I think “Oh, and it would be even BETTER if you could do…” 🙂 But I think being able to specify a range of numbers would turn out to be a VERY useful feature in the end.

  3. Great stuff, but this feature should be somewhat accessible (I know you said you aren’t ready to re-do a UI…); I was thinking auto completion/content assist, on typing + or -, display a dropdown with the available keywords. bonus, an example with it for each line.

    • Beorn says:

      Yes, autocomplete would be perfect for this. When I can get some time, this is precisely the kind of UI feature that I want to add. It will help to make advanced search easier and less error-prone but it won’t clutter up the basic search UI.

  4. lleimmoen says:

    Hi Beorn, have you got a chance to grab Nin-in-Eilph yet? You know, us Eropean players often depend on you to finally see the pictures — and long before they get their paws on the cards.

    • Beorn says:

      Yes indeed, I picked it up last week. I have been very busy making other improvements to Hall of Beorn Card Search, but I will try to get spoilers and images up soon.

  5. lleimmoen says:

    Oh, that would be lovely, thanks!

  6. lleimmoen says:

    ps: At least the player cards… (that have not been spoilt on FFG)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s