Skip to main content
OCLC Support

Use Custom Queries and Results

Learn how to access and use Custom Queries and Results (CQR) in CONTENTdm.

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 for defining your queries. You will select 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

The first step is to specify the type of query you want to create. The choices are:

  • 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)

In the second step, 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

In Step 3, 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 thesearch 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 viewin gmode from the fiveoptions 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 selectedto 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.

Grid View

From the Field name column, choose up to five fields from the drop-down lists to display. The options presented are either the Dublin Core fields, if searching across multiple collections, or the existing fields in the specified collection if searching in only one collection.

From the Display options column, choose how much data to display in the specified fields. Options include displaying the entire field, a specified number of characters, or search keywords in context (100 characters preceding and 100 characters following the bolded search keywords shown).

From the Link to item column, check the boxes associated with the fields that users can click on to access items. Then, specify the maximum number of records to display on a results page.

Finally, select the priority of up to five fields by which to sort and display the results, or choose to sort and display by relevancy.

Relevancy is an option for priority-one sorting only and sorts the results according to their relevance to your specified search first. Relevancy is determined by the frequency and distribution of matching keywords in each record, compared to other records. Matches in the Title or Subject field that are mapped to Dublin Core are given more relevancy weight. (Relevancy sorting is available for sorting search results only; it does not apply to the browse options.)

Bibliographic View

From the Field name column, choose up to five fields from the drop-down lists to display. The options presented are either the Dublin Core fields, if searching across multiple collections, or the existing fields in the specified collection if searching in only one collection.

From the Display options column, choose how much data to display in the specified fields. Options include displaying the entire field, a specified number of characters, or search keywords in context (100 characters preceding and 100 characters following the bolded search keywords shown).

In the Separator column, choose what you want to separate the fields. Options are new line, comma, period, or space.

From the Link to item column, check the boxes associated with the fields that users can click on to access items. Then, specify the maximum number of records to display on a results page.

Finally, select the priority of up to five fields by which to sort and display the results, or choose to sort and display by relevancy.

Relevancy is an option for priority-one sorting only and sorts the results according to their relevance to your specified search first. Relevancy is determined by the frequency and distribution of matching keywords in each record, compared to other records. Matches in the Title or Subject field that are mapped to Dublin Core are given more relevancy weight. (Relevancy sorting is available for sorting search results only; it does not apply to the browse options.)

Thumbnails View

Select the number ofresults to display in the view, including rows and columns if there is more than one way to display the number of results.

Finally, select the priority of up to five fields by which to sort and display the results, or choose to sort and display by relevancy.

Relevancy is an option for priority-one sorting only and sorts the results according to their relevance to your specified search first. Relevancy is determined by the frequency and distribution of matching keywords in each record, compared to other records. Matches in the Title or Subject field that are mapped to Dublin Core are given more relevancy weight. (Relevancy sorting is available for sorting search results only; it does not apply to the browse options.)

The options presented are either the Dublin Core fields, if searching across multiple collections, or the existing fields in the specified collection if searching in only one collection.

Titles View

Select the number of titles to display on a results page.

Select up to five fields from the drop-down lists by which to sort and display the results. The options presented are either the Dublin Core fields, if searching across multiple collections, or the existing fields in the specified collection if searching in only one collection.

Hierarchical View

Select the number of results per page and choose the sort and display order for up to five fields.The options presented are either the Dublin Core fields, if searching across multiple collections, or the existing fields in the specified collection if searching in only one collection.

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:

  1. 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.
  2. 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.
  3. 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.
  4. Paste (Ctrl+v) the generated code into the Web page in the location you want the index box to appear.
  5. 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:

  1. 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). 
  2. 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. 

 

  • Was this article helpful?