Using tag filters inside query parameters
The codes snippet below shows the implementation of the Apex Class Controller.
q defines the set of tags that must be present on the image search results. In the above example, the query parameter contains:
'q' => '"tag1" "tag2" "tag3"'
This indicates that only images with both tags, irrespective of which album they belong to, are to be displayed on the search results.
q can take other values that can broaden or narrow the scope of the search results. The examples below show how this can be made possible.
- To view images from all 3 albums, the query should be:
'q' => '"album1" "album2" "new album"'
Note that double quotes are used for text with spaces. They are optional if no spaces are contained.
- To view images from 2 albums and with both of the 2 tags:
'q' => 'tags:(+("album1" "album2") +("tag1" AND "tag 2"))'
- To view images from 2 albums and with either of the 2 tags:
'q' => 'tags:(+("album1" "album2") +("tag1" OR "tag 2"))'