The RXML Interface consists of a set of tags that are used to input queries from the user and present the results of running the queries. The absolute minimum you have to write to get a search page with a search form and a results listing is:
You can also have the search form and the result listing on different pages:
The search form and the results listing communicate via form variables. However you can override various aspects of their behaviour. E.g. you can write a results listing for a hard-coded query:
To create a customized form, use <search-form> as a container. Since it will generate a <form> container in the output, you can use all <input> and <select> elements that you would use in any <form>. You can add attributes to the resulting <form> by adding them to <search-form>, e.g. change the method="GET" (which is the default), to method="POST".
Example (in French):
For convenience, there are two subtags that you can use inside <search-form>:
Since the default RXML code for <search-form> and <search-results/> communicate via form variables, you have to make sure that if you alter either one of them, the other checks for the right variables. If you put this inside <search-form>:
Enter your query: <input type="text" name="q"/>
The tag <search-results> is used to generate multipage search result listings. As seen above it can be used as a single tag, thereby using the default RXML content.
The search results listing can also be customized and given different layouts. There are two subtags to <search-results>, namely <search-results-entries/>, and <search-results-tabs/>.
<search-results-entries/> generates a listing of hits, but only the hits on the current page. When used as a single tag, a default piece of RXML code is inserted.
<search-results-tabs/> generates a tab list with links to other pages with hits. When used as a single tag, a default piece of RXML code is inserted.
Inside <search-results> there are entities available about the results of the search. For example, you can create a result page that does not show links to the matching documents, but rather just some info about the search:
But then you would want to present the matching documents too. That is done with the <search-results-entries> container. It loops through the documents on the current listing page, in order. How many documents it will loop through can be controlled by setting the perpage attribute of the surrounding <search-results> container, or if that attribute is missing, the default setting in the SiteBuilder Interface is used. A good value is probably somewhere between 10 and 20.
What document will start with depends on what page is focused. That is controlled by the page="" attribute to the surrounding <search-results> container, or if that is missing, by the form variable 'page'.
For each document, the <search-results-entries> container runs through its content, setting the entities to different values before each loop to reflect the properties of the current document. There are more than ten different entities so refer to the documentation for the tag for all of them. An easy example using the most useful of them:
The tag <search-results-tabs/> works similarly. But instead of looping through the documents on the current page, it loops through all pages in the listing. For each page it gives information about on which document it starts and ends, what page number it has and so on. This tag is used to make a list of links to the other pages. It can be used as a container if you want to make your own layout of the links.
In each link, make sure to pass, along with the page number, all variables that are needed to identify the search, namely:
&_.query;, &_.query-profile;, &_.db;, and &_.type;