Mendapatkan hasil penelusuran untuk aplikasi media
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menunjukkan cara melihat pratinjau hasil penelusuran untuk aplikasi media menggunakan konsol dan cara mendapatkan hasil penelusuran menggunakan API.Google Cloud
Untuk menerapkan aplikasi penelusuran, Anda dapat membuat widget penelusuran untuk ditambahkan ke halaman web atau melakukan panggilan API dan mengintegrasikan panggilan tersebut ke halaman web atau aplikasi Anda.
Tentang mode penelusuran
Ada beberapa mode kueri penelusuran untuk aplikasi media:
Kueri lengkap: Saat pengguna akhir ingin seluruh istilah atau frasa penelusuran mereka ditelusuri. Misalnya, di aplikasi streaming musik, pengguna mengetik seluruh judul lagu dan menelusurinya sekaligus. Ini adalah cara penelusuran yang lebih disukai saat menggunakan antarmuka input yang memungkinkan pengguna menelusuri sekaligus, seperti input audio atau input keyboard.
Dalam kueri lengkap, jika entri menyertakan kesalahan ejaan, pengguna berharap kesalahan tersebut diperbaiki.
Kueri parsial (atau penelusuran saat Anda mengetik): Saat pengguna akhir menerima serangkaian hasil penelusuran baru secara dinamis saat mereka mengetik setiap huruf. Misalnya, di aplikasi streaming musik, pengguna mulai memasukkan nama lagu yang mereka cari dan dengan setiap huruf yang mereka ketik, hasil penelusuran akan diperbarui dan dipersempit secara dinamis.
Mode otomatis: Mode otomatis adalah campuran mode penuh dan sebagian. Dengan mode otomatis, Anda membiarkan penelusuran media memutuskan apakah akan menampilkan hasil kueri sebagai sebagian atau penuh.
Untuk menentukan kemungkinan niat pengguna akhir, penelusuran media menganalisis dan
menimbang berbagai sinyal, seperti jumlah huruf yang dimasukkan, kecepatan
entri, dan apakah entri tersebut adalah entitas yang dikenali—misalnya, nama
aktor atau film.
Mode yang akan digunakan
Mode default untuk kueri penelusuran media adalah mode otomatis. Namun, ada skenario di mana Anda dapat memilih untuk mengganti mode default dan menentukan mode kueri penuh atau sebagian. Berikut beberapa contoh kasus penggunaan:
Skenario
Mode
Anda sangat yakin bahwa kueri pengguna akhir Anda adalah kueri lengkap. Misalnya, Anda memiliki kotak penelusuran yang menyertakan fungsi
Enter untuk menandai kueri selesai dan pengguna menekan Enter.
Kueri lengkap
Anda sangat yakin bahwa kueri pengguna akhir Anda dimaksudkan sebagai
kueri parsial—yaitu, mereka mengharapkan daftar hasil diperbarui
setelah setiap huruf dimasukkan.
Kueri parsial
Tidak ada skenario di atas yang berlaku. Biarkan penelusuran media memutuskan apakah
akan menampilkan hasil kueri sebagai sebagian atau penuh.
Otomatis
Mendapatkan hasil penelusuran untuk aplikasi media
Anda dapat melihat pratinjau hasil penelusuran dari Google Cloud konsol atau mendapatkan hasil penelusuran
menggunakan API. Untuk mendapatkan hasil penelusuran aplikasi media:
Konsol
Untuk menggunakan Google Cloud konsol guna melihat pratinjau penelusuran media dan mengonfigurasi widget:
Di konsol Google Cloud , buka halaman AI Applications.
APP_ID: ID aplikasi Vertex AI Search yang ingin Anda
kueri.
QUERY: teks kueri yang akan ditelusuri.
SPEC_CONDITION: spesifikasi penelusuran saat Anda mengetik dapat memiliki salah satu nilai berikut:
ENABLED: untuk kueri parsial
DISABLED: untuk kueri lengkap
AUTO: untuk sebagian atau seluruhnya sebagaimana dianggap sesuai. Jika Anda
mengosongkan kolom SPEC_CONDITION atau tidak menentukannya,
mode penelusuran default adalah AUTO.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[],[],null,["# Get search results for media apps\n\nThis page shows how to preview search results for media apps using the\nGoogle Cloud console and how to get search results using the API.\n\nTo implement the search app, you can create a [search widget](/generative-ai-app-builder/docs/add-widget) to add\nto your web page or you can make API calls and integrate those calls into your\nwebpage or application.\n\nAbout search modes\n------------------\n\nThere are several modes of search query for media apps:\n\n- **Full queries**: When end users intend for their whole search term or\n phrase to be searched for. For example, in a music streaming app, users type\n the whole title of the song and search for it in one go. This is a preferred\n way of searching when using an input interface that lets users search in one\n go, such as audio input or keyboard input.\n\n In full queries, if the entry includes a spelling mistake, users expect that\n mistake to be corrected.\n\n This is the same behavior as search for non-media (custom)\n apps. See [Get search results for an app with structured or unstructured\n data](/generative-ai-app-builder/docs/preview-search-results#structured-unstructured).\n- **Partial (or search-as-you-type) queries**: When end users dynamically\n receive a new set of search results as they type each letter. For example,\n in a music streaming app, users start entering the name of the song they're\n searching for and with each letter they type, the search results dynamically\n update and narrow down.\n\n- **Auto mode**: Auto mode is a mix of full and partial modes. With auto\n mode, you let media search decide whether to return query results as partial\n or full.\n\n To determine the end users' probable intent, media search analyzes and\n weights various signals, such as the number of letters entered, the speed of\n entry, and whether the entry is a recognized entity---for example, the name of\n an actor or movie.\n\nWhich mode to use\n-----------------\n\nThe default mode for media search queries is the auto mode. However, there are\nscenarios where you might choose to override the default mode and specify the\nfull or partial query mode. Here are some use-case examples:\n\nGet search results for a media app\n----------------------------------\n\n| **Note:** Depending on the amount of data, it can take hours after data ingestion to generate a preview.\n\nYou can preview search results from the Google Cloud console or get search results\nusing the API. To get search results for a media app: \n\n### Console\n\nTo use the Google Cloud console to preview media search and to configure a widget:\n\n1. In the Google Cloud console, go to the **AI Applications** page.\n\n [AI Applications](https://console.cloud.google.com/gen-app-builder/start)\n2. Click the name of the media search app.\n\n3. Click **Configurations**.\n\n4. Click the **UI** tab.\n\n5. On the **UI** tab, set the **General configurations** and **Data display**\n options.\n\n6. In the **Preview** pane, start typing a query.\n\n \u003cbr /\u003e\n\n7. To save the configurations and to make them available in the **Integration**\n tab, click **Save and publish**.\n\n### REST\n\nUse the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method to\nget search results for a media app:\n\n1. Find your app ID. If you already have your app ID, skip to the next step.\n\n 1. In the Google Cloud console, go to the **AI Applications** page.\n\n [Go to Apps](https://console.cloud.google.com/gen-app-builder/engines)\n 2. On the **Apps** page, find the name of your app and get the app's ID from\n the **ID** column.\n\n2. Run the following curl command to get search-as-you-type results.\n\n All the fields except for `contentSearchSpec` can be used in conjunction with\n the `searchAsYouTypeSpec` field. For clarity, the optional fields have been\n omitted from the curl command. For the optional fields, see [Get search\n results for an app with structured or unstructured\n data](/generative-ai-app-builder/docs/preview-search-results#structured-unstructured). \n\n curl -X POST -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search:search\" \\\n -d '{\n \"query\": \"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"searchAsYouTypeSpec\": {\"condition\": \"\u003cvar translate=\"no\"\u003eSPEC_CONDITION\u003c/var\u003e\"}\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n - \u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e: the ID of the Vertex AI Search app that you want to query.\n - \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the query text to search.\n - \u003cvar translate=\"no\"\u003eSPEC_CONDITION\u003c/var\u003e: the search as you type spec can\n have one of the following values:\n\n - `ENABLED`: for partial queries\n - `DISABLED`: for full queries\n - `AUTO`: for partial or full as deemed appropriate. If you leave the `SPEC_CONDITION` field empty or don't specify it, the default search mode is `AUTO`.\n\n #### Example command and partial result\n\n ```bash\n curl -X POST -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/collections/default_collection/engines/my-app/servingConfigs/default_search:search\" \\\n -d '{\n \"query\": \"Mission Impossible\",\n \"searchAsYouTypeSpec\": {\"condition\": \"DISABLED\"}\n }'\n\n {\n \"results\": [\n {\n \"id\": \"189333\",\n \"document\": {\n \"name\": \"projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/189333\",\n \"id\": \"189333\",\n \"structData\": {\n \"uri\": \"http://mytestdomain.movie/content/189333\",\n \"title\": \"Mission: Impossible - Fallout (2018)\",\n \"categories\": [\n \"Action\",\n \"Adventure\",\n \"Thriller\"\n ],\n \"available_time\": \"2023-01-01T00:00:00Z\",\n \"media_type\": \"movie\",\n \"expire_time\": \"2033-01-01T00:00:00Z\"\n }\n }\n },\n {\n \"id\": \"111781\",\n \"document\": {\n \"name\": \"projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/111781\",\n \"id\": \"111781\",\n \"structData\": {\n \"media_type\": \"movie\",\n \"available_time\": \"2023-01-01T00:00:00Z\",\n \"uri\": \"http://mytestdomain.movie/content/111781\",\n \"title\": \"Mission: Impossible - Rogue Nation (2015)\",\n \"categories\": [\n \"Action\",\n \"Adventure\",\n \"Thriller\"\n ],\n \"expire_time\": \"2033-01-01T00:00:00Z\"\n }\n }\n },\n ...\n {\n \"id\": \"116507\",\n \"document\": {\n \"name\": \"projects/123456/locations/global/collections/default_collection/dataStores/my-data-store/branches/0/documents/116507\",\n \"id\": \"116507\",\n \"structData\": {\n \"uri\": \"http://mytestdomain.movie/content/116507\",\n \"categories\": [\n \"Comedy\"\n ],\n \"media_type\": \"movie\",\n \"available_time\": \"2023-01-01T00:00:00Z\",\n \"title\": \"Mission London (2010)\",\n \"expire_time\": \"2033-01-01T00:00:00Z\"\n }\n }\n }\n ],\n \"totalSize\": 5628,\n \"attributionToken\": \"vgL0PQEKDAiZxMbCBhD2koiqAxIkNjg1MWM3OTUtMDAwMC0yOWVmLThhNzUtZDQzYTJjYzdiYmNmIgVNRURJQSpUtreMLa_WoTGs1qExwvCeFaOAlyKrtZwxxcvzF-7r6TGotZwxkPeyMI6RyTDPv-Iw1L_iMJvWty2Ovp0V1LKdFfHr6THs4K8tkvGsMJXxrDCY1rctMAFKEjB4OTYzYjdjNGE0ZGYwN2FhZlKUAXByb2plY3RzLzc1NjIwNjYwODQ3OS9sb2NhdGlvbnMvZ2xvYmFsL2NvbGxlY3Rpb25zL2RlZmF1bHRfY29sbGVjdGlvbi9lbmdpbmVzL3F1aWNrc3RhcnQtbWVkaWEtcmVjb21tZW5kXzE3NDUwMjUyMjYwNDMvc2VydmluZ0NvbmZpZ3MvZGVmYXVsdF9zZWFyY2g\",\n \"nextPageToken\": \"Y2YiJ2NjNmMhNDNk1SN3EGOtYWZ5ITLwADMw0CN5czYxUDO2QiGDI9kgzIEGIs1tmJCMIBM1IgC\",\n \"summary\": {},\n \"queryExpansionInfo\": {}\n }\n ```\n\n\u003cbr /\u003e\n\nNext steps\n----------\n\n- [Add the search widget to a web page](/generative-ai-app-builder/docs/add-widget)"]]