What are Search Queries?
BLOX CMS features robust search functionality, allowing a variety of query parameters to be passed through the URL for defining specific asset searches. These query parameters are passed either through the URL or search form.
When being passed through the URL, the query is formatted with a question mark and then the name of the query parameter, followed by an equals sign and then the value. Multiple query parameters can be passed and should be separated within the query using an ampersands.
domain name + ? + query parameter + = + value
Search Parameters
Category
Query a list of categories (or sections tags) to search against. Multiple categories can be included by formatting the query as c[].
Short parameter: c
Long parameter: category
Example
Single category: https://www.example.com/search/?c=news
Single category and subcategories: https://www.example.com/search/?c=news*
Multiple categories: https://www.example.com/search/?c[]=news,sports
Block ID
This parameter will return search results for Editorial, Community, and Marketplace applications. The Block ID can be found in the Title of the actual block or in the Widget Embed Code. This parameter accepts as input a single block ID. When a block ID is passed, all other search parameters are no longer relevant except offset (o), limit (l), and format (f). Format can be used to get RSS, JSON, or HTML (the default). The block template adapter should be extended to have a method called search_params that accepts any of the following parameters:
short parameter: bl
offset: The offset to start the search at. By default, this should the limit of the block plus one. If passed, this will override the limit. If zero or empty, offset should be omitted.
limit: The maximum results to return. The default should be 50 - the maximum number of items a block can return.
format: The format parameter. By default, no format should be passed. Allows for RSS and other choices to be crafted.
This parameter will return search results for Editorial, Community, and Marketplace applications.
Example
<a href="https://www.example.com/search/?[% this.block.search_params('limit': 25) | html %]">More items from this block</a>
This example would return: <a href="https://www.example.com/search/?bl=1234&1=25"a>More items from block</a>
Flag
Query a list of flags to search against. Multiple flags can be included by formatting the query as f[]. To use the fl parameter, the application must be declared, even when the desired application is the same as the default application.
short parameter: f
Example
http://example.com?fl[]breaking,top_story
Application
Query a list of applications to search against. The default application is editorial.
short parameter: app
Supported applications: business, calendar, classifieds, editorial and eedition.
Example
Start Date
Query a start date to search against. If a start date isn't applied, the query will list results without any time constraints.
short parameter: d1
long parameter: start_date
End Date
Query an end date to search against. If a start date isn't applied, the query will list results without any time constraints. f 'd2' is provided, this acts as the end range. If not provided, it is assumed 'today'. Future search dates are only available within BLOX and not available to readers on the website.
short parameter: d2
long parameter: end_date
When using d1 and d2 date range parameters, the start date should be the date that is furthest in the past. Additionally, some PHP natural language relative specifiers may be used when creating a search query. For example, the following will provide search results that include article assets that are less than 3 months old: &d1=90%20days%20ago&d2=today
Date Selector
A boolean value, when set to on, can be used in combination with the d1 variable to search a range of dates with a specific phrase. This is frequently used to generate search results for a range of time using a worded phrase such as "today", "yesterday", "24+hours+ago".
short parameter: d
long parameter: date_selector
Example
http://www.example.com/search/?c[]=news&d=on&d1=48+hours+ago
If hours are being included, the following parameter should be added: &xd=1.
Example: http://www.example.com/search/?c[]=news&d=on&d1=48+hours+ago&xd=1
Result Format
The output format of the results. The default is 'html'. Other choices include 'atom' and 'rss'.
short parameter: f
long parameter: format
Keyword Search
Query a keyword to search against. This parameter only looks for keywords that have been listed within the Tags tab of an asset. Search results will pull both the correct and incorrect version of Latin-based words with accented letters, for example: senor and señor. Additionally, you will need to search for multiple-word keyword tags by enclosing the tag in quotes.
Using the hashtag (#) at the start of your keywords will tell the system to NOT display them where keywords are normally displayed - for example, in front-page blocks or at the bottom of stories. If you'd like to search for keywords that start with a pound sign, however, you must remember to URL encode them within the query string.
short parameter: k
long parameter: keywords
Example
Limit
A results limit can be passed using this parameter. The default limit is 10.
short parameter: l
long parameter: limit
secondary parameter: num
Offset
This parameter determines how may search results to skip before producing search results. This is required for paging.
short parameter: o
long parameter: offset
secondary parameter: start
Query Search
A query for the search terms provided. This is in a full text format, searching the headline, body text and keyword tags.
short parameter: q
long parameter: query
Sort Order
Sort the results in the order of the given definition. The default is 'asc.' Another choice would be 'desc.'
short parameter: sd
Sort By
Sort the results by the given definition. The default is 'relevance.' Other choices would be 'start_time', 'priority' and 'title.'
short parameter: s
Asset Type
A list of asset types that you would like returned. Options are: Article, Image, Collection, Audio, Flash, HTML, Link, PDF, Poll, Table, Video, YouTube, ZIP. If a selection of asset types is not made, all types will be returned.
short parameter: t
long parameter: type
Article with Preview Image Only
This allows you to search on Article Assets that have a Preview Image only.
Parameter: hpr=1
Author
This will search the author field for the string provided.
short parameter: a
Example
Byline
This will search the byline field for the string provided.
short parameter: b
long parameter: byline
Example
Update Time
This will search the time the asset was updated.
short parameter: s
Search Parameter Exclusions
Search exclusions can be added to filter out query results.
Exclude by Category
Query a list of categories (or sections tags) to search against. Multiple categories can be included by formatting the query as c[].
Short parameter: nc
Long parameter: no category
Example
The following query will search for assets, excluding assets that have been section-tagged to /sports and subsections.
Exclude by Flag
A RSS feed can be created, based on a search that excludes assets with a specific flag.
Short parameter: nfl
Long parameter: no flag
Example
The following query will search for all assets, while excluding contributed assets, while generating an RSS feed.
Exclude by Keyword
A RSS feed can be created, based on a search that excludes assets with a specific keyword.
Short parameter: nk
Long parameter: no keyword
Example
The following query will search for all assets, while excluding the keyword school, while generating an RSS feed.
Exclude by Source Application
A RSS feed can be created, based on a search that excludes assets created by a specific application.
nsa=eedition is used by default on most search forms in BLOX to prevent assets created by the eEdition application from showing up in regular searches.
Short parameter: nsa
Long parameter: no application
Example
The following query will search for all assets, while excluding assets created by the e-Edition application.
Search Queries for Classifieds
Search queries can be used to query ads created within BLOX Classifieds.
Ad search including all asset types: http://www.example.com/classifieds/?l=a00&q=
Liner ads: http://www.example.com/classifieds/?l=100&q=&t=ad
PDF Display ads: http://www.example.com/classifieds/?l=100&q=&t=pdfdisplayad
Coupon ads: http://www.example.com/classifieds/?l=100&q=&t=coupon
RSS Feeds Image Size
By default, images will come through an RSS Feed in a 300 pixel width by 200 pixel height. Use the 'ips' parameter to specify the width size you want it set to.
- short parameter: ips
- long parameter: ips=1000 (ie: using 1000 pixels - set this to the size you want - it can go anywhere in the string)