Landmarks Search APIChanges in Landmarks Search API documentation
Changes in Landmarks Search API
PurposeThe purpose of Landmarks Search API is to extend Landmarks API to enable searching for landmarks or landmark categories that match certain criteria. For instance, a client can search for all the landmarks under the category "Restaurants" in a landmark database. Landmarks Search API is used mainly by end-user applications. API DescriptionLandmarks Search API is mainly targeted for end-user applications. It lets clients search for landmarks and landmark categories in landmark databases. The logical type of this interface is Library API. Technically this is a method-call API. Landmarks Search API loads the implementation at run time but the implementation consists only of local objects. API class structureThe following sections describe the Landmarks Search API class structure. UML diagrams are used to present the classes and their dependencies. Note: The UML diagrams do not show all the available functions, and some or all function parameters may be left out. Main classes
The Landmarks Search API allows searching in a single database
or in multiple databases by means of
Related APIs
Criterion classes
Related APIs
Result classesWhen using the landmark item iterator to retrieve search matches, the matches will not be sorted until the search operation has completed. If the client needs a sorted list of the matches before the search has completed, e.g. it wants to show matches in a sorted list as they are found to the application user, the display data feature should be used instead.
Before a search is started, the client specifies
Related APIs
Using the Landmarks Search APISearching landmarks
The client uses CPosLandmarkSearch to search landmarks in a landmarks
database. To create a
Configuring search
Maximum number of matches
The client can set a maximum number of matches by calling
If the client does not set a maximum, the search returns all the
matches in the database. The client can also set this explicitly by
passing
Search previous matches only
If the
Searching previous matches is useful if there are too many matches and the application user wants to narrow down the search before listing all matches.
It is also possible to use
Sort preference The client can specify that the matching landmarks or landmark categories should be sorted.
One of
Related APIs
Specifying search criteria
In order to specify what landmarks to search for the client uses
criterion classes. The criteria are passed to
Landmarks by category
If no category is specified, the search operation retrieves uncategorized landmarks. The predefined global landmark categories are listed in Landmarks API Specification. Matching text pattern
The search is case insensitive. If no position fields or landmark attributes to search are specified, all the position fields and landmark attributes are searched in each landmark. Wild card characters are supported in the search string: "?" matches any single character and "*" matches zero or more consecutive characters. Landmarks within an area
Note: This search does not consider landmark coverage radius (coverage radius is defined in Landmarks API ). The area borders must fulfill the following rules:
The east border longitude can be less than the west border longitude. This defines an area, which crosses the 180 meridian. If the east and west border longitudes are equal, only landmarks that lie on the specified longitude are returned. Similarly, if the north and south border latitudes are equal, only landmarks that lie on the specified latitude are returned. If west longitude is set to -180 and east longitude is set to +180, all longitudes are included in the search. Nearest landmarks
Since this operation returns all the landmarks in the database
by default, it is recommended to combine the nearest criteria with
a limit on the number of matches. The match limit is set by calling
It is often a good idea to specify a maximum distance to narrow
down the search. This is done by calling
By default, the coverage radius of the landmarks is not considered
in the search; that is, the distance to the landmark center point
is used. The client can change this behavior by calling
Composite criterion
The client combines the criteria by passing each criterion instance
to
If
Note:
ID list
This criterion must be combined with other search criteria using
For example, if this criterion is combined with
Note: Only one ID list criterion is allowed in a composite criterion.
Related APIs
Executing search
A search for landmarks is started by calling
This function returns a
Instead of calling
If the search is run incrementally, the client is informed of the
search progress. The client passes a TReal32 variable to
Progress is a floating point number in the interval [0.0, 1.0]. 0.0 indicates that the operation has not started and 1.0 indicates that the operation has completed.
The client also passes
The IDs of the matches from the search can be retrieved
by calling
The sequence diagram below shows how client searches landmarks by text criterion and reads matches from database. The following code example shows how to perform a search synchronously (not incrementally) in a landmark database.
The following example shows how to use composite criterion to search for restaurants, which contain the text “thai”.
The following example shows how to use composite criterion to search for landmark which start from latter "A" or " A" (space + A)”, Example result for this type of search can be 'Apple' & ' My Apple' both.
Related APIs
Retrieving displayable results
The client can specify a displayable data collection that will
be populated with the matching landmarks or landmark categories during
the search. This is done by creating a
The client can specify that only partial landmark data will be
read from the database by calling
When searching for categories, full category data is always read from the database.
The client can unset a previously set display data by calling
If display data has been set before the search is started, all
matches from the search can be retrieved by calling
During a search,
The following sequence diagram shows how to perform a search synchronously (not incrementally) in a landmark database using display data.
The following example shows how to search a landmark database incrementally.
The client also requests to sort the matches. The implementation is
encapsulated in active object class
Related APIs
Related APIs
Searching categories
A search for landmark categories is started by calling
Searching for categories supports only one search criterion,
Similarly to searching landmarks searching categories also supports limiting maximum amount of results and searching within previous results only. Following code example shows how a client can search for categories, which contain word "food" (in order to find categories such as "Food and beverages", "Chinese food", etc.).
Related APIs
Search multiple databasesSearching for landmarks or landmark categories in multiple landmark databases is rather similar to searching in one database.
The client creates a
However, there are some restrictions on the criterion classes and some extra functionality needed to handle several databases:
This example shows how to perform a search synchronously (not incrementally) in multiple landmark databases.
Related APIs
Error handlingLandmarks Search API uses the standard Symbian error reporting mechanism. In case of a serious error, panics are used. Otherwise, errors are reported through return codes or leaves. Landmarks Search API uses the same panic code category as Landmarks API. The panic codes are documented in Landmarks API specification. Memory overheadIf there are several matches (more than 1000) in a search, a large amount of memory is needed to store the matches. It might therefore be a good idea to set a maximum number of matches before starting the search. Note, however, that it is the first found matches that are retrieved. For example, if the maximum number of matches is set when searching in sorted order, the result can be without a match although its name is in the beginning of the sort order. Security issues
Landmarks are considered as important user data and this applies
some access limitations to client applications. For example, in order
to be able to read landmarks from landmark database client must have
Related APIs
GlossaryDefinitionsDefinitions
|