Send feedback
Create a custom search page
You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation . info
Note: The integrated portal is available as an Apigee-managed solution for Apigee Edge for Public Cloud customers only.
If you are an Apigee Edge for Private Cloud customer, refer to the customer-managed Drupal portal solution .
To enable search of the publicly available content in your portal, you can create a dedicated search page where you embed a Google Custom Search Engine (CSE) . For example, the portal shown in the following figure, embeds a Google CSE that enables searching the content indexed by Google.
Before embedding a Google custom search engine, note the following:
Search using a Google CSE can return only results for publicly available content . In other words, a portal user must not be required to sign in to the portal to view the content.
At this time, you cannot disable ads in search results unless you are an approved non-profit site.
Google CSE is not included with an Apigee license. (An out-of-the-box search solution in the integrated portal is planned for a future release.)
The Google Search Console (also not included with an Apigee license) is another tool you may use to remove or manage your portal's presence in Google's search index.
To create a custom search page:
Publish your portal content .
Create a Google custom search engine:
a. Navigate to the Google custom search configuration page.
b. Click Add to create a new custom search engine.
c. Configure your custom search engine and identify the portal site domain. See Create a search engine in the Google Custom Search Help.
d. Expedite site indexing by verifying and submitting your site using Google WebMaster tools. See Verify your site in Webmaster tools in the Google Custom Search Help.
Add the following custom script to your portal. See Add custom scripts .
Set the cx
variable to your Google search engine ID and the path
value to your search page URL.
<script >
window . portal = {
pageEventListeners : {
onLoad : ( path ) = > {
// Update with your search page URL
if ( path === '/ your - search - page - URL ') {
// Add your Google search engine ID
var cx = 'your - search - engine - id ';
var gcse = document . createElement ( 'script ');
gcse . type = 'text / javascript ';
gcse . async = true ;
gcse . src = 'https : // cse . google . com / cse . js ? cx = ' + cx ;
var s = document . getElementsByTagName ( 'script ')[ 0 ];
s . parentNode . insertBefore ( gcse , s );
gcse . onload = function () {
var search = document . createElement ( 'gcse : search ');
// Note the element ID name
var searchBox = document . getElementById ( 'search - box ');
searchBox . appendChild ( search );
};
}
}
}
};
</ script >
Create a new search page in your portal and customize it as desired. See Manage pages in your portal .
Add the custom search element ID (search-box
) defined in your custom script at the location that you want the Google search box to appear.
For example:
<div id="search-box"></div>
Add the search page to your portal navigation, as required. See Set up navigation for more information.
Publish your search page and navigation updates.
It takes time for Google to index your site so you may not see search results right away. (It can take a couple of days up to a month to complete full indexing.) You may want to delay publishing the search page until you have tested your portal site search (over time) and are satisfied with the results being returned.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-30 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-04-30 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-30 UTC."],[],[]]