Use Custom Queries and Results
Access CQR
After items have been added to the collection and you are ready to create queries from your collection Web pages, access Custom Queries and Results by typing the following URL in your Web browser address bar: https://YourCustomCONTENTdmURL.contentdm.oclc.org//cdm4/cqr/cqr1.php
Replace YourCustomCONTENTdmURL with the address of your CONTENTdm server. This opens CQR and you can begin to define the kinds of queries you want to create.
Use CQR
Custom Queries and Results leads you through the process of defining your queries. You will select a query type, specify which collections the query will search, define search terms, specify Web templates and viewing options, and then receive your generated code. Once you have that code, you can paste it into a Web page.
Step 1. Select query type
Specify the type of query you want to create:
- A simple hyperlink
- A drop-downlist
- An index box
- A text box
- A browse page
- Default view parameters
Make a selection and click Next.
Step 2. Select collection(s)
Specify the collection or collections to which the query should apply. This step does not apply if you have selected to create default parameters.
The type of query specified in Step 1 determines whether you may select a single collection, multiple collections, or all the collections on the server. CQR presents the appropriate options based on your query choice.
The index box query may only be applied to a single collection. Specify a collection and click Next.
Step 3. Define query
Continue defining the parameters of the query. In the index box example, the field on which the index box should be based must be specified. Only searchable fields will be presented as options.This step does not apply if you have selected to create default parameters.
Select the search field and click Next.
Note: Metadata added to the Description field afterthe query has been created will not appear in the index box unless the query is recreated.
Step 4. Specify Web Templates for search results and image display
The Define Results View page has three separate sections. This first section allows you to choose the HTML templates to use when displaying results and displaying items and to specify the directory if the templates are not located in the default /cdm4 directory. Whether you use your own custom templates, or modify the default templates, you may also specify the default view and configure other view settings for your collection display templates.
The Web templates control the layout of the page and placement of the results within the page. By customizing the CONTENTdm Web Templates, your collection pages can be designed to match the look of your site.
The two default HTML templates are:
- Results Template: This template displays search results according to the viewing settings configured in Step 4.
- Item Display Template: This template is displayed when a user clicks on an item from the search results page. The item display template shows an item with all its associated metadata. If you are simply modifying the default templates, the existing path and file name must remain the same.
If using custom templates, the files must be on the server. Specify the path and the file name relative to the Web home directory in the appropriate text boxes in Step 4.
Comments within the template files help you and the software determine placement of data and variables. If you edit the templates, be aware that changing the order of the comments may affect the system functionality. Comments can be distinguished by the characters:
- <!-- -->
- /*
- //
Step 5. Select the default viewing mode
The Define Results View page also allows you to choose the default viewing mode from the five options presented. This is the results view that will be presented initially to users. Users can choose other options using Preferences which will override the default view specified in CQR.
- Grid—Displays up to five fields
- Bibliographic—Displays text (no images) from as many as five fields
- Thumbnail—Displays a thumbnail image and the item title
- Title—Displays only item titles
- Hierarchical—Displays search results sorted in groupings. The fields selected to sort by are the fields that are shown in this results view.
Once you’ve selected the default viewing mode, specify the configuration. Each mode has slightly different options.
Step 6. Define compound object results display
Choose whether you want to display compound objects only in search results or whether you want the pages that make up the compound objects to be displayed as well.
When you have finished, click Next to go to Step 7 where the code is generated that will meet your specifications.
Step 7. Receive query code
The figure below shows the code generated by CQR. In this example, the index box we have defined is displayed as it will appear on your Web pages. Users will click on terms within the index box to conduct a search. Review and click on terms in the index box to be sure you are satisfied with your query and display settings. To edit any results display settings, click Back.
Step 8. Paste query code into web page
If you are satisfied with your query, copy the code from the text box to the desired Web page. To do this:
- Open the Web page (in your HTML editing program or in a text editor) that you wish to have the custom query. This is often the collection home page, which is index.php, contained within the docs directory of your server.
- Ready your Web page for the custom query. This may include adding tables, rows, or cells to the existing HTML code and/or adding text explaining the custom query.
- Highlight and copy (Ctrl+c) the code from the text box (be certain to copy all of the code within the text box) on the final page of CQR.
- Paste (Ctrl+v) the generated code into the Web page in the location you want the index box to appear.
- Save the file.
After pasting the CQR-generated code into your Web page, review your changes to the Web page through a Web browser. To do this:
- Open your Web browser and enter the URL of your CONTENTdm server in the address bar (or enter the URL of the page you just changed if it differs from index.php).
- Refresh the page if you do not see your changes. You may also need to delete your cookies and your temporary internet files from your Web browser. These options are usually found in your Internet options menu in your Web browser.