eT4® META > eT4® META - Search > Query Language > Introduction |
This chapter gives a general insight in the query language of eT4.META API :
Almost all listed prefixes are also available also for the q-Parameter .
A query consists of one or more search terms.
All terms can be combined using boolean operators (e.g. AND, OR).
Using the prefixe notation specific data fields can be queried.
By default the search results are sorted by relevance.
If a different sort oder is desired, the Sort - Parameter can be supplied.
Simple search terms can be directly used in the query.
Terms can either be single words ("Tennis") or phrases ("tennis inside").
These terms can arbitrarily be combined with boolean operators.
The given term is searched in all relevant data fields and the search results are sorted by relevance by default. (i.e. a full-text search is performed).
Example:
q=Tennis
Terms with a specified field and without can be arbitrarily combined.
Different fields differ in behavior depending on their data type. Possible search modes are full-text search, exact terms, integers, double values or date ranges.
Example:
q=category:Tennis
Find a detailed description of all available fields in the section Query Language - Prefixes.
You can append the * wild card at the end of the word.
This way not only the exact word but also words beginning with this term will be found.
Examples:
- q=Beer => search for the keyword "Beer" with appropriate relevance sorting.
- q=Beer* => search for "Beer" and for example "beergarden" with appropriate relevance sorting.
A range query is most useful in combination with integer, double, geographical coordinates or date value fields.
The syntax for a range query is fieldname:[MinValue TO MaxValue].
The min/max values are included in the search. For an exclusive search use {} braces.
You can use the * symbol for MinValue or MaxValue, which indicates that this end of the range is unbounded.
Examples:
q= class_dehoga:[3 TO *] => search for objects with the classification by *** or more.
q= class_dehoga:{2 TO 5} => search for objects with a rating of more than 2 stars and less than 5 stars.
See: Query Language - Prefixes section, for an example with range search.
The default value is 1.
Depending on your desired results you may have to try different boost values because the calculated base weights vary by many factors such as the given terms and the specific query.
Example:
q=tennis^5.0 hotel => the keyword "tennis" is weighted higher than "hotel", therefore objects matching the term "tennis" are strongly preferred.
Groups with parenthesis are often used shortening multiple searches in a single field.
AND
The AND operator specifies that all clauses must match.
Examples:
q= category : Hotel AND class_dehoga:[3 TO *] => all objects with the category Hotel and 3 DEHOGA stars or more.
q= keyword:(Keyword1 AND Keyword2) => both keywords must be included.
OR
The OR operator specified that at least one of the clauses must match.
Examples:
q= category:hotel OR category:apartment => all objects that have hotel or apartment as a category.
q= category:(hotel OR apartment) => the same request, but shorter notation with grouping.
NOT / -
The NOT operator determines that the following expression may not be fulfilled.
Examples:
q=beer NOT category:hotel => all elements containing the keyword "beer", but aren't of the category: hotel.
q=beer -category:hotel => identical request..
q=-category:Hotel AND all:all => special request for a pure exclusive search.
This can be combined with boolean operators in particular. You can group together the OR-clauses so those are evaluated preceding the AND operator.
Example:
q=(category:Hotel OR keyword:HotelX) AND keyword:KeywordX => show all objects with category hotel or the keyword "HotelX". The entries must have the keyword "KeywordX".
Following queries are equal: prefix:Value1 OR prefix:Value2 ; prefix:(Value1 OR Value2).
Example:
q=category:hotel OR category:apartment == q=category:(hotel OR apartment)
Special characters: + - && || ! ( ) { } [ ] ^ " ~ * ? : \
Example:
q="\(Hotel\)" =>search for the term (Hotel).