Skip to content

Searching for labels by name uses incorrect syntax #334

Description

@BeeHiveJava

Describe the bug
As seen in an article here: https://help.trello.com/article/808-searching-for-cards-all-boards, when looking at the "label" section, the following syntax can be used to search for labels:

label:"FIX IT" or #label

However the second example does not include quotes. I think the Trello API, however, does expect quotes. For example:

#"label"

Upon investigation, the query builder does not seem to add these quotes (which makes sense to me since it doesn't seem to be documented).

To Reproduce
When manually searching, adding the quotes, it works:

var board = trelloFactory.Board(~ID~);
var result = trelloFactory.Search("#\"label_name\"", modelTypes: SearchModelType.Cards, context: new [] {board});

await result.Refresh();
Console.WriteLine(result.Cards.Count());

When attempting to use the search query builder, it does not work:

var board = trelloFactory.Board(~ID~);

await board.Labels.Refresh();
var label = board.Labels.Single(l => l.Name == "label_name");

var query = trelloFactory.SearchQuery().Label(label);
var result = trelloFactory.Search(query, modelTypes: SearchModelType.Cards, context: new [] {board});

await result.Refresh();
Console.WriteLine(result.Cards.Count());

Expected behavior
I expected to be able to search for a label by specifying it when calling SearchQuery().Label().

Desktop

  • OS: Windows 10
  • Target: netcoreapp3.1
  • Version: 4.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions