-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
wb_search() does not return a match when you search on the exact indicator string.
Reproduce as follows:
wb_search("A woman can be head of household in the same way as a man (1=yes; 0=no)")
Warning message:
In wb_search("A woman can be head of household in the same way as a man (1=yes; 0=no)") :
no matches were found for the search term A woman can be head of household in the same way as a man (1=yes; 0=no). Returning an empty data frame.
If I use the indicator_id, i get a valid result with the indicator variable exactly as i had it above.
wb_search("SG.HLD.HEAD.EQ")
# A tibble: 1 × 3
indicator_id indicator indicator_desc
<chr> <chr> <chr>
1 SG.HLD.HEAD.EQ A woman can be head of household in the same way as a man (1=yes; 0=no) The indicator measures whether there are restrictions on a woman becoming head of household or head of family.
This looks like it is caused by a regex issue. If i escape the parenthesis it works:
wb_search("A woman can be head of household in the same way as a man \\(1=yes; 0=no\\)")
# A tibble: 1 × 3
indicator_id indicator indicator_desc
<chr> <chr> <chr>
1 SG.HLD.HEAD.EQ A woman can be head of household in the same way as a man (1=yes; 0=no) The indicator measures whether there are restrictions on a woman becoming head of household or head of family.
I would expect a search string to work without having to be escaped to valid regex. Suggest that this is either implemented, or documented in the documentation. The ideal option would be to have some sort of "regex = TRUE" parameter that could be toggled to handle strings vs regex expressions in the search.
Metadata
Metadata
Assignees
Labels
No labels