# Query Parameter
The query parameter allows you to specify an expression that will filter your results when combined with a request type defined in Usage. This is the main function of 1search that allows it to be a faceted search engine.
Note: The q= parameter must be accompanied by one or more requests that
produce results otherwise nothing will be returned.
# AND and OR Operators
In order to request a specific facet you must first specify the aspect it is part of e.g.
q=Genre.Fantasy.
The full stop after the request must always be there in order to get results.
Adding more than one facet from the same or a different aspect requires
an And or Or keyword at the front with ._. separating each of the
aspect facet combinations. e.g.
q=(Or.Genre.Fantasy._.Genre.Horror.)
In this example, it is combining the two results saying to get results if it contains both Genre.Fantasy or Genre.Horror.
# NOT and Child Operators
There are two other kinds of requests that can be performed using the expresso
format, a Child and a Not. A child is an operation used
with the C. at the start, C Expressions are used to combine a parent and
child aspect and provide results. It is the same as an And operation.
The second kind of operation, the Not. operation, will return all items
except items containing the part that is within the Not.. e.g.
q=(Not.Series.Harry Potter.)
q=And.Genre.Adventure Fiction._.(Not.(C.Genre.Adventue Fiction._.Series.My Hero Academia.))
This will return all items except ones that are of series Harry Potter. In the second example, it is combining two parts to show that it wants items of the genre adventure fiction, but no items from the series of adventure fiction "My Hero Academia".
# Special Operators
Note all special operators are CASE SENSITIVE, this includes range, location, poi, and keyword. They must all be specified as entirely lower case.
# Range Operator
The range operand can be used when querying range types and filtering the results within a range of values from that type. For example, if you have a range defined as Price, you will then be able to use a query parameter to query data within a certain price range. e.g.
q=Price.range(100..200).
This example will filter the data to only provide results that have price values within 100 and 200.
# Date and Time Range
The Expresso syntax also allows for Date and Time format to be used when requesting items within a date and time range, e.g.
q=PublishDate.range(2015-02-16T05:50:06..2020-05-28T16:49:45).
This request will return all books published between the 16th February 2015 at 5:50:06AM and the 28th May 2020 at 4:49:45PM. The date and time format used is UTC format YYYY:MM:DDTHH:MM:SS where the T separates the date format and time format. Ranges defined within the Indexes Config also include regular number ranges such as Price where instead of a date, numbers are given as the range.
# Location and POI Operator
Location and POI can also be specified similar to how a range is specified. If a location or poi is configured you can specify a latitude and longitude followed by a x**km where ** defines a set radius to search in. e.g.
q=booksNearMe.location(-35.333,105.68x10km).
In this example, it is searching with a radius of 10km with those coordinates
which are specified within the POI config. If a
POI is specified within the Indexes config
you can also use .poi(locationNamexRadiuskm) instead, where locationName
is a defined location name within that POI configuration. e.g.
q=booksNearMe.poi(Richmondx25km)
This example will search with a radius of 25km in the suburb Richmond. This is helpful for keyword searches as results can be filtered out to a name of a place that is defined within the POI configurations instead of specifically providing a latitude and longitude. However, for you to be able to query the data using locational data and POIs you have to first set up a GeoLocation and provide your data with the appropriately formatted GeoLocation data.
# Keyword Operator
Keywords can also be searched for by using the keyword item name set up in
the indexes configuration under the keyword request, followed by keyword(). e.g.
q=BooksAll.keyword(fantasy novel)
The keyword search will filter out any of the stop words set up in the keywords configurations and will search for the keywords in any of the aspects or ranges defined within the keyword tag. This is explained further in keywords
# Query Parameter counterpart
The q= parameter (seen above) also has another version of itself known as an SEO request
which takes an SEO-friendly URL and performs the same action as a q request
but with the bonus of converting the SEO friendly URL into an actual
query first. However, because it is implausible to convert all queries into
SEO-friendly URLs due to difficult queries or conflicts, sometimes the
front end will have to use a q= parameter (seen above) to gather the correct data instead
of an SEO request.
