QPlaceSearchRequest Class
QPlaceSearchRequest クラスは、検索リクエストのパラメータのセットを表します。詳細...
| Header: | #include <QPlaceSearchRequest> |
| qmake: | QT += location |
パブリック型
| enum | RelevanceHint { UnspecifiedHint, DistanceHint, LexicalPlaceNameHint } |
パブリック関数
| QPlaceSearchRequest() | |
| QPlaceSearchRequest(const QPlaceSearchRequest &other) | |
| QPlaceSearchRequest(QPlaceSearchRequest &&other) | |
| ~QPlaceSearchRequest() | |
| QList<QPlaceCategory> | categories() const |
| void | clear() |
| int | limit() const |
| QString | recommendationId() const |
| QPlaceSearchRequest::RelevanceHint | relevanceHint() const |
| QGeoShape | searchArea() const |
| QVariant | searchContext() const |
| QString | searchTerm() const |
| void | setCategories(const QList<QPlaceCategory> &categories) |
| void | setCategory(const QPlaceCategory &category) |
| void | setLimit(int limit) |
| void | setRecommendationId(const QString &placeId) |
| void | setRelevanceHint(QPlaceSearchRequest::RelevanceHint hint) |
| void | setSearchArea(const QGeoShape &area) |
| void | setSearchContext(const QVariant &context) |
| void | setSearchTerm(const QString &term) |
| void | setVisibilityScope(QLocation::VisibilityScope scope) |
| QLocation::VisibilityScope | visibilityScope() const |
| QPlaceSearchRequest & | operator=(const QPlaceSearchRequest &other) |
関連する非メンバー
| bool | operator!=(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs) |
| bool | operator==(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs) |
詳細な説明
典型的な検索リクエストは、次のようなものになります。
QPlaceSearchRequest searchRequest;
searchRequest.setSearchTerm("Fast food"); //search term for what we are interested in
//set a search center
searchRequest.setSearchArea(QGeoCircle(QGeoCoordinate(2.3, 48.87)));
//set a distance hint as a relevancy hint.
//closer places have greater weighting in the ranking of results.
searchRequest.setRelevanceHint(QPlaceSearchRequest::DistanceHint);
//use limit to adjust pagination.
//this limits the number of place results to 5 per page.
searchRequest.setLimit(5);
//provide some categories to narrow down search
QList<QPlaceCategory> categories;
categories << diner << restaurant;
searchRequest.setCategories(categories);なお、検索中心点を指定するには、中心点は指定するが半径を指定しない円形の検索領域を設定することで行えます。デフォルトの半径は -1 に設定されており、これは半径が未定義であることを示します。プロバイダはこれを、独自のデフォルト半径を自由に選択できるものと解釈します。
QPlaceSearchRequestは、主にQPlaceManager からsearch for places への呼び出しで使用されますが、generating search term suggestions へのパラメータ指定にも使用されます。この文脈では、関連するパラメータは一部のみである点に注意してください。例えば、検索領域は関連性の高い検索候補を絞り込むのに役立ちますが、関連性ヒントなどの他のパラメータはそれほど適用されません。
また、プロバイダーによってサポートされるパラメータが異なる場合がある点にも注意してください。たとえば、ページネーションをサポートするプロバイダーもあればサポートしないプロバイダーもありますし、関連性のヒントを反映するプロバイダーもあれば完全に無視するプロバイダーもあります。詳細については、プラグインのドキュメントを参照してください。
メンバータイプのドキュメント
enum QPlaceSearchRequest::RelevanceHint
場所の検索結果の順位付けに役立つヒントを定義します。
| 定数 | 値 | 説明 |
|---|---|---|
QPlaceSearchRequest::UnspecifiedHint | 0 | 明示的なヒントは指定されていません。 |
QPlaceSearchRequest::DistanceHint | 1 | 検索中心からの距離は、ユーザーにとって重要です。近い場所ほど重みが高くなります。このヒントは、クエリで円形の検索エリアが使用されている場合にのみ有用です。 |
QPlaceSearchRequest::LexicalPlaceNameHint | 2 | 場所を名前順に並べ替えることは、ユーザーにとって重要です。 |
メンバー関数のドキュメント
QPlaceSearchRequest::QPlaceSearchRequest()
デフォルトコンストラクタ。新しいリクエストオブジェクトを生成します。
[noexcept] QPlaceSearchRequest::QPlaceSearchRequest(const QPlaceSearchRequest &other)
other のコピーを作成します。
[constexpr noexcept default] QPlaceSearchRequest::QPlaceSearchRequest(QPlaceSearchRequest &&other)
QPlaceSearchRequest のインスタンスをMoveコンストラクタで生成します。
[noexcept] QPlaceSearchRequest::~QPlaceSearchRequest()
リクエストオブジェクトを破棄します。
QList<QPlaceCategory> QPlaceSearchRequest::categories() const
検索リクエストで使用するカテゴリを返します。場所がリクエストによる一致とみなされるためには、それらの場所がいずれかのカテゴリに属していれば十分です。
setCategories()も参照してください 。
void QPlaceSearchRequest::clear()
検索リクエストをクリアします。
int QPlaceSearchRequest::limit() const
取得する検索結果の最大件数を返します。
limit に負の値を指定すると、その値は未定義となります。返す結果の適切な数は、バックエンドプロバイダに委ねられます。デフォルトの制限値は -1 です。
setLimit()も参照してください 。
QString QPlaceSearchRequest::recommendationId() const
類似するスポットのおすすめを検索するために使用されるスポットIDを返します。
setRecommendationId()も参照してください 。
QPlaceSearchRequest::RelevanceHint QPlaceSearchRequest::relevanceHint() const
リクエストの関連性ヒントを返します。このヒントは、検索結果の順位付けを支援するためプロバイダーに提供されるものであり、順位付けを強制するものではありません。たとえば、距離のヒントを提供すると、より近い場所が上位に表示される可能性がありますが、必ずしも結果が距離順に厳密に並べ替えられるとは限りません。
setRelevanceHint()も参照してください 。
QGeoShape QPlaceSearchRequest::searchArea() const
検索結果を絞り込むために使用される検索範囲を返します。デフォルトの検索範囲は、無効な `QGeoShape` であり、特定の検索範囲が定義されていないことを示します。
setSearchArea()も参照してください 。
QVariant QPlaceSearchRequest::searchContext() const
この場所検索リクエストに関連付けられた、バックエンド固有の追加検索コンテキストを返します。この検索コンテキストは通常、proposed search results の一部として設定されます。
setSearchContext()も参照してください 。
QString QPlaceSearchRequest::searchTerm() const
検索語を返します。
setSearchTerm()も参照してください 。
void QPlaceSearchRequest::setCategories(const QList<QPlaceCategory> &categories)
指定されたcategories のリストから検索を行うよう、検索リクエストを設定します。検索中に返される場所はいずれも、categories のいずれか一つ以上と一致します。
categories() およびsetCategory()も参照してください 。
void QPlaceSearchRequest::setCategory(const QPlaceCategory &category)
検索リクエストを、単一のcategory
setCategories()も参照してください 。
void QPlaceSearchRequest::setLimit(int limit)
検索結果の最大取得数をlimit に設定します。
limit()も参照してください 。
void QPlaceSearchRequest::setRecommendationId(const QString &placeId)
レコメンデーションの検索に使用されるplaceId を設定します。
recommendationId()も参照してください 。
void QPlaceSearchRequest::setRelevanceHint(QPlaceSearchRequest::RelevanceHint hint)
場所を検索する際に使用する関連性「hint 」を設定します。
relevanceHint()も参照してください 。
void QPlaceSearchRequest::setSearchArea(const QGeoShape &area)
指定されたarea 内で検索を行うように検索リクエストを設定します。
searchArea()も参照してください 。
void QPlaceSearchRequest::setSearchContext(const QVariant &context)
検索コンテキストを `context` に設定します。
注:このメソッドは 、geoサービスプラグインがQPlaceSearchResult::ProposedSearchResult 型の検索結果を返す際に使用することを想定しています。
検索コンテキストは、バックエンドが検索リクエストに関連する追加情報を保存するために使用されます。その他の関連フィールドも設定する必要があります。たとえば、検索コンテキストがテキスト検索をエンコードしている場合、検索語句も `setSearchTerm()` で設定する必要があります。検索コンテキストを使用することで、Qt Location API からは直接アクセスできない追加情報を保持することができます。
検索コンテキストは、QVariant に格納可能な任意の型とすることができます。検索コンテキストの値は、アプリケーションが直接使用することを意図したものではありません。
searchContext()も参照してください 。
void QPlaceSearchRequest::setSearchTerm(const QString &term)
検索対象を `term` に設定します。
searchTerm()も参照してください 。
void QPlaceSearchRequest::setVisibilityScope(QLocation::VisibilityScope scope)
場所を検索する際に使用されるscope の表示設定を指定します。
visibilityScope()も参照してください 。
QLocation::VisibilityScope QPlaceSearchRequest::visibilityScope() const
場所を検索する際に使用される可視性スコープを返します。デフォルト値はQLocation::UnspecifiedVisibility であり、これは明示的なスコープが割り当てられていないことを意味します。検索時には、どのスコープの場所でも返される可能性があります。
setVisibilityScope()も参照してください 。
[noexcept] QPlaceSearchRequest &QPlaceSearchRequest::operator=(const QPlaceSearchRequest &other)
この検索リクエストにother を割り当て、この検索リクエストへの参照を返します。
関連する非メンバー
[noexcept] bool operator!=(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs)
lhs がrhs と等しくない場合は true を返し、そうでない場合は false を返します。
[noexcept] bool operator==(const QPlaceSearchRequest &lhs, const QPlaceSearchRequest &rhs)
lhs がrhs と等しい場合は true を返し、そうでない場合は false を返します。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.