meta: Query Language

meta: 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.

Expressions

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

Fields

By specifying prefixes/fields you can filter the data pool for matches in the specified fields.
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.

Wildcard search

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.

Range

A range query may be performed on specific fields.
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.

Boost

With the ^ symbol parts of the query can be boosted. This means they are more important and are scored higher in results ordered by relevance.
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.

Boolean operator

Terms can be combied with boolean operators.
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.

Grouping

All elements can be grouped using parentheses.
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".

Field grouping

The field grouping is a special group that leads to a shorter query.
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)

Escape syntax character

To escape special characters use the \ before the character.
Special characters: + - && || ! ( ) { } [ ] ^ " ~ * ? : \

Example:
q="\(Hotel\)"  =>search for the term (Hotel).

Prefixes

Prefixes - Default

Field
Type
Sort
Sample
Description
title
Query.Standard
Yes
q=title:Golfplatz
sort=title asc
You can search for a word in the title.
If the title field (see: title) is used for sort: asc = A-Z, desc = Z-A
category
Query.Singleword
Yes
q=category:Golf
sort=category asc
Search for a specific category. No full-text search is performed, the whole category name must be supplied including spaces, umlauts and accents.
The field can be sorted.
See Also: Falk Connected API - Categories
keyword
Query.Singleword
No
q=keyword:XYZ
Search for a certain keyword / tag. No full-text search is performed.
rating_*
Query.Rating
Yes
q=rating_pricerange:[50 TO 100]
sort=rating_pricerange asc
Any rating in the data pool can be queried. Ratings are always in the range of 0-100%.
The RatingType is appended to the prefix rating_ . (E.g. rating_pricerange: [50 TO 100] search == all with a pricerange rating of 50% or higher).
attribute_*
Query:Exact
Yes
q=attribute_extraField:XYZ
Search for certain additional attributes.
attribute_license
Query:Exact
Yes
q=attribute_license:(CC0 OR CC-BY OR CC-BY-SA)
Search for only items that have the given open data license.
See also https://open.destination.one/
highlight
Query.Boolean
Yes
q=highlight:true
sort=highlight desc
highlight:true returns only items that have the highlight flag.
When sorting, please use "sort=highlight desc", if the highlighted objects should appear first.
accessability
Query.Boolean
Yes
q=accessibility:true
sort=accessibility desc
Search for objects that are marked as accessible (barrier free).
When sorting, please use "sort=accessible desc", if the accessible objects should appear first.
child_friendly
Query.Boolean
Yes
q=child_friendly:true
sort=child_friendly desc
Search for child-friendly objects.
When sorting, please use "sort = familyfriendly desc", if the family-friendly objects should appear first.
globalid
Query.Exact
No
q=globalid:1_123
Find an object based on it's global id. In the form: {ChannelId} _ {Id}
channelid
Query.Integer
No
q=channelid:1
The output is restricted to certain channels. (z.B. 1 = MairDumont, 2 = Hotel.de)
sourceid
Query.Exact
No
q=sourceid:123
Search an object using the ID provided by the content provider partner. There are other filters necessary (e.g. channelid), since this ID is not unique.
contentid
Query.Integer 1-10
Yes
q=contentid:1
sort=contentid asc
The topic can be restricted with the ContentId. Following topics are available:

Prefixes - Geo

Field
Type
Sort
Sample
Description
zip
Query.Standard
Yes
q=zip:93462
sort=zip asc
Search for a postal code.
city
Query.Standard
Yes
q=city:Lam
sort=city asc
Search for place names.
street
Query.Standard
Yes
q=street:Gaberlplatz
sort=street asc
Search for a street name.
country
Query.Standard
Yes
q=country:ITA
sort=country asc
Search by country. Please use 3 digit ISO code (ISO 3166-1 ALPHA 3).
area
Query.Standard
No
q=area:Golf
Search for a touristic region. The available areas vary per project and region.
lat
Query.Double
No
q=lat:[48.5 TO 49.0]
Specifying the latitude range to be searched. Range is required [48.1 TO 49.0].
This prefix is an alternative to the parameter NWLatitude and &SELatitude.
Useful only in conjunction with the lon- prefix.
lon
Query.Double
No
q=lon:[12.1 TO 12.5]
Specifying the longitude range to be searched. A range is required [12.5 TO 12.9].
This prefix is an alternative to the parameters &NWLongitudeand &SELongitude
Only in conjunction with thelat-prefix.

Prefixes - Special

Field
Type
Sort
Sample
Description
all
Query.All
No

q=-category:Hotel AND all:all

q=systag:has_video OR all:all
A special type in the form "all: all" can be used.

This field is necessary so a pure negative search can be performed where there are no other inclusive criterias.

Example: "-category:Hotel" does not work, because there is no result set to remove hotels from => solution: "-category: Hotel AND" all:all"
systag
Query.Systag
No
q=systag:has_video
Special data of the object can be queried with the systag- prefix.
So the value of "has_video" indicates whether the object has links of the type of "Video".
nearlinestring
Query.Exact
No
q=nearlinestring:....
With nearlinestring it is possible that objects will be searched along a path. A perimeter can be specified, how wide the corridor is, in which to search.
nearhashlink
Query.Exact
No
q=nearhashlink:~30km 86...A06
The surrounding items are displayed to the selected object (using the GlobalId).
Furthermore, the RADIUS in km or m can be determined.
Regex: ^~(\d+)(k?m) ([A-Z0-9]{32,})

Prefixes - Tour

Field
Type
Sort
Sample
Description
length
Query.Integer
Yes
q=length:[* TO 500]
sort=length asc
Filtering of data based on the length of the tour in m.
Ranges should be used here. ([1000 TO *] = tours with min. 1km in length) 
difficulty
Query.Integer (0-5)
Yes
q=difficulty:[* TO 3]
sort=difficulty asc
An indication of the difficulty as integer value. The values of 1-5 are possible. (very easy, easy, medium, hard, very hard)
duration
Query.Integer in s
Yes
q=duration:[* TO 6000]
sort=duration asc
Duration of the tour in minutes. Ranges can be used.
[60 TO *] = tour with at least one hour duration.
[15 TO 30] = tour in the range of 15-30 minutes.
altdiff
Query.Integer
Yes
q=altdiff:[* TO 300]
sort=altdiff asc
Altitude supervisory and descent. Ranges can be used.
elevmax
Query.Double
Yes
q=elevmax:[* TO 1000]
sort=elevmax asc
Maximum height above the sea level in meters. Ranges can be used.
elevmin
Query.Double
Yes
q=elevmin:[500 TO *]
sort=elevmin asc
Minimum height above the sea level in meters. Ranges can be used.
round_tour
Query.Boolean
Yes
q=round_tour:false
sort=round_tour desc
roundtour:true returns tours, if they are a round trip
When sorting, please use "sort=roundtour desc", if the round trip objects should appear first.
rest_stop
Query.Boolean
Yes
q=rest_stop:true
sort=rest_stop desc
reststop:true returns tours, where there is a possibility of refreshment along the tour.
When sorting, please use "sort = reststop desc", if objects with a possibility of refreshment along the tour should appear first.

Samples

Sample 1: Hotel stars

Task

Show top 10 hotels with DEHOGA star rating 1 to 3 in experience demo-dahoam

Solution

Description

Used parameters:

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type: Hotel
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to Hotel.

q: class_dehoga[1 TO 3]
Search queries can be defined with the parameter Q, so that the amount of data returned is constrained. For more details see chapter Query Language - Introduction and Query Language - Prefixes. Search field class_dehoga for values 1 till 3.

limit: 10
The number of returned records is limited to the specified value. Limit resultset to 10.

sort: empty
The result can be sorted via this parameter. See more details in the Query Language Introduction chapter. Leave sort empty, so default-sort relevance will be used.

Sample 2: Hotel with horse

Task

Fulltext search for hotels with fulltext "pferd" (horse)

Solution

Description

Used parameters:

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type : Hotel
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to Hotel.

q: Pferd
Search queries can be defined with the parameter Q, so that the amount of data returned is constrained. For more details see chapter Query Language - Introduction and Query Language - Prefixes. Search field fulltext for "Pferd".

limit: 10
The number of returned records is limited to the specified value. Limit resultset to 10.

Sample 3: Paging: get 3rd page with 5 items per page

Task

Get top objects from all type limited to 5 objects per page; Get 3rd page.        

Solution

Description

Used parameters:

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type: All
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to All.

limit: 5
Limit resultset to 5.

offset: 10
Start at item 10 and get 3rd page.

Sample 4: Top 10 tours with mountain

Task

Get top 10 tours of category biking that do not contain "Berger" (mountains) in fulltextsearch

Solution

Description

Used parameters:

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type: Tour
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to Tour.

q: category: Radfahren AND -Berge
Search queries can be defined with the parameter Q, so that the amount of data returned is constrained. For more details see chapter Query Language - Introduction and Query Language - Prefixes. Search field category = radfahren (Biking) and fulltext not berge (mountains).

limit: 10
The number of returned records is limited to the specified value. Limit resultset to 10.

Sample 5: Tours with min distance > 50 km

Task

Get tours that are longer than 50 kilometers.

Solution

Description

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type: Tour
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to Tour.

q: length:[50000 TO *]
Search queries can be defined with the parameter Q, so that the amount of data returned is constrained. For more details see chapter Query Language - Introduction and Query Language - Prefixes. Search field length: 50000 - *.

limit: 10
The number of returned records is limited to the specified value. Limit resultset to 10.

Sample 6: Tours of type bike or hiking with distance > 5km

Task

Get tours with a distance greater than 5 kilometers thar have category radfahren (biking) or wandern (hiking).

Solution

Description

experience: demo-dahoam
The experience specifies the name of the project data pool to be used.  (obligatory) Use this experience to get data from eT4.META-search.

type: Tour
Used to specify the main content type/topic to search. Hotel, Event, Gastro, Tour, POI, City, Area, Package, Article or Web. Set type to Tour.

q: length:[5000 TO *] AND category:(Radfahren OR Wandern)
Search queries can be defined with the parameter Q, so that the amount of data returned is constrained. For more details see chapter Query Language - Introduction and Query Language - Prefixes. Search field length for values greater than 5000 and field category for values radfahren or wandern.

limit: 10
The number of returned records is limited to the specified value. Limit resultset to 10.

Check out more samples at our API-Explorer: http://developer.et4.de/explorer/?samples=true
    • Related Articles

    • meta-service: keyterms

      Entry Point http://meta.et4.de/rest.ashx/keyterms  Responsetype JSON-Response Description The destination.one meta KeyTerms service returns keyterms to one object. Parameters Parameter Type Description experience String The experience specifies the ...
    • meta-Service: topterms

      Entry Point http://meta.et4.de/rest.ashx/topterms Responsetype JSON-Response Description Returns topterms. Parameters Parameter Type Description experience String The experience specifies the name of the project data pool to be used.  (obligatory) q ...
    • meta-service: hypersearch

      Entry Point http://meta.et4.de/rest.ashx/hypersearch/ Responsetype TemplateBased-XML-Response TemplateBased-JSON-Response TemplateBased-Protobuff-Response Description The meta.destination.one hyper search is a meta-search based on meta-data. The ...
    • meta-service: feedchecker

      Entry Point http://meta.et4.de/feedcheck.aspx Responsetype HTML-Page Description Analyzes a GeoRssFeed and shows the contained errors and warnings. Parameters Parameter Type Description e String The experience specifies the name of the project data ...
    • meta-Service: search

      Entry Point http://meta.et4.de/rest.ashx/search/ Responsetype TemplateBased-XML-Response TemplateBased-JSON-Response TemplateBased-Protobuff-Response Description The search service returns the project data. You can use query language to filter the ...