When a list of taxonomies is passed into our search engine it returns all records that have at least one of those taxonomies. In other words, given taxonomies A, B, and C it will return all records that have A or B or C.
Our query engine now allows us to pass in more advanced logic, including this scenario:
Return records with (A AND B) OR (A AND C)
Eventually, these kinds of advanced queries will have controls in the user interface. For now they have to be manually created.
Our team is here for training and support if you have a use-case for advanced queries :)
Examples
A basic query for Veteran Benefits Assistance, Veteran, and Active Duty Military looks like this:
?query=FT-1000.9000,YN-9000,YN-0500
An advanced query for Benefits Assistance for Veterans OR Benefits Assistance for Active Duty would look like this:
?query={
"OR": [
{ "AND": ["FT-1000.9000", "YN-9000"] },
{ "AND": ["FT-1000.9000", "YN-0500"] }
]
}
We could get the same results this way:?query={ "AND": [
"FT-1000.9000", {
"OR": ["FT-1000.9000", "YN-0500"]
}
]
}
Both are supported; feel free to form queries the way that makes the most sense to you.We could also modify that to return broader results for just Active Duty Military:
?query={
"OR": [
{ "AND": ["FT-1000.9000", "YN-9000"] },
"YN-0500"
]
}
URL Encoding
Before the above structures are actually put into a URL for an advanced search, they must strip all white space and be encoded using an online tool like https://www.urlencoder.org/. The results might look a little strange, but that’s just how URLs work.
Our examples above look like this after being condensed and encoded:
Example 1
?query=FT-1000.9000%2CYN-9000%2CYN-0500
Example 2.a
?query=%7B%22OR%22%3A%5B%7B%22AND%22%3A%5B%22FT-1000.9000%22%2C%22YN-9000%22%5D%7D%2C%7B%22AND%22%3A%5B%22FT-1000.9000%22%2C%22YN-0500%22%5D%7D%5D%7D
Example 2.b
%3Fquery%3D%7B%22AND%22%3A%5B%22FT-1000.9000%22%2C%7B%22OR%22%3A%5B%22FT-1000.9000%22%2C%22YN-0500%22%5D%7D%5D%7D
Example 3
?query=%7B%22AND%22%3A%5B%22FT-1000.9000%22%2C%7B%22OR%22%3A%5B%22FT-1000.9000%22%2C%22YN-0500%22%5D%7D%5D%7D
Summary
This is a more advanced feature so don’t feel bad if it doesn’t immediately make sense. Please do reach out to Connect 211 support if you think this may be useful and you would like training: [email protected].
