The setup options available under Web service setup are designed to make handling the web service XML output easier to handle. The Web service setup page is available under Setup → Package name → Web service setup.
Adjusting the search results title
This allows you to set fallback options to render in the search results page if the page title is empty. Alternatively, it is possible to set any body tag or meta tag to be displayed as a preference before the page title, and only if these are not available the page title will be used.
Select a tag from the Title tag column.
Select which version to use from the Field column. The choices are as follows:
- Text: The contents of the body or meta tag with all HTML tags stripped out.
- Searchdata: The contents of the body or meta tag with all HTML tags stripped out, and with any search and replace actions defined under Search Ranking performed.
- Raw: The raw HTML contents of the body or meta tag.
Select a document type that this should apply to. For example, you may wish to perform a certain action on PDF documents but not on HTML documents.
Click Update to add another fallback option.
When a satisfactory fallback sequence has been defined, search-and-replace actions can be performed on the final output.
Example
A site has good titles on its main section, but not in the News section of the site. In stead, a body tag called News header has been set up to capture the page header, which has been defined with a start tag of <h1 class="news_header"> and an end tag of </h1>.
The news section of the site use this persistent title:
Example site - News
Defining a fallback sequence
In order to set up sensible titles in the search results, the following settings can be used:
- First, select the News header tag in the Title tag column. Leave Field and Mime type at their default values, Text and All. Click Update. A new row appears, providing a second fallback, which will be used if the News header is empty, as is the case on all pages except pages in the News section.
- Secondly, select <title> from the Title tag column in the new row. Click update.
- Finally, you can add a fallback text to display if neither the News header nor the page title are populated; e.g. No title.
This sequence ensures that the search results from the News section output the news header, and search results from the rest of the site output the page title.
Defining Search-and-replace actions
The title that is output now is almost perfect, apart from the site name, which is part of every page title. This is good for internet search engines, where the context is extremely important. However, in a local search, the context is already known, so it clouds the search result needlessly.
The page title is formatted as follows:
Example site - Page title
In order to avoid outputting Example site - on every search result, perform a search and replace to remove it.
- Enter Example site in the Match column.
- Leave the Evaluator column blank.
- Click Update.
This replaces Example site - with nothing on every page, making sure that the search engine only outputs the part of the page title that is unique to that page.