Adlib API home page > Documentation > Enhancing the API search performance

Enhancing the API search performance

As far as the configuration of your Adlib databases and Adlib API is concerned, the performance and results of API searches can be enhanced by applying combined indexes for term indexed fields that often contain more than a single word (like person names or object names) and/or for almost identical linked fields, and by using search indirection in your API queries or adlibweb.xml configuration file to access those combined indexes.

Use combined link reference indexes and indirected searching for performance enhancement

Suppose you would like to perform queries (either search= or q= queries) with which you can search multiple fields linked to the same database and lookup field. For example, author.name, corporate_author, publisher, illustrator.name and person.keyword.name in the DOCUMENT database all link to the name field in the PEOPLE database. To search all of these fields for a single name, there's a more efficient way than to list all fields in the search statement and combine them with a Boolean OR. What you can do is create a dummy linked field and use its link reference tag to index the link reference fields of the individuel linked fields you wish to search together and then perform a search on the single dummy linked field indirected to the remote name field, to get the same result but faster. Proceed as follows:

  1. In the main database (DOCUMENT in our example), create a new linked field and link reference field, linked to the same database (PEOPLE in the example) and lookup field as the linked fields you wish to collect. (This field will not actually contain any data so it is considered a dummy field.)
  2. Create an index on the dummy link reference field (this should be the primary indexed tag) and below it in the list of fields to be indexed, list the tags of the other link reference fields to be searched as one. Remember to actually reindex the new index.
  3. Using the indirection symbol ->, you can now search the collected linked fields all at once via the new dummy linked field and the remote field in the linked database (name in our example), for example: http://ourinstitution.com/collection/wwwopac.ashx?database=Catalogue&search=people.link-%3Ename=
    Simmons*
    , if people.link was the name of your dummy linked field. (-%3E is the URL encoded -> indirection symbol.)

Use combined free text indexes and indirected searching to expand search results for terms and names

Names in Adlib typically start with the surname followed by a comma and the first name. Normally, the name field in the PEOPLE database (Persons and institutions), in which author and creator names and other linked names from the catalogue records are stored, is indexed as a single term, meaning that when you search this field, the search key must always start with (a partial or complete ) surname: you cannot just search on the first name. The same applies to the term indexed term field in the THESAU database (Thesaurus), in which object names and other linked terms from the catalogue records are stored: if you have an object name which consists of more than a single word, you cannot find the object by searching on the second or third word, for example; you must always start the search key with the first word.
However, for simple searching, as typically provided by internet search engines and by our Internet Server web application, one expects to be able to find catalogue records by searching on a first name or the second word of an object name just as well as when searching on surname or the first word of an object name. To improve the user experience and expand the search result of your Adlib API based web application in this way, you can make a combined free text index on a dummy field plus the term field in THESAU and another on a second dummy field plus the name field in PEOPLE. This way, all words in the name and term fields will also be indexed separately (in THESAU and PEOPLE respectively), allowing you to perform a search on the same field in the catalogue as before, yet indirected to the relevant remote dummy field to get the expanded search results. Proceed as follows:

  1. In the THESAU database, create a new normal field of data type Text, call it term.word for example. The field will not actually contain any data so it is considered a dummy field.
  2. Create an index on the dummy field (this should be the primary indexed tag) and below it in the list of fields to be indexed, enter the tag of the main term field (usually te). The index should be of the key type Free text and have a key size identical to the maximum length of the term field (yet maximally 100). So the index will contain two indexed tags: firstly your new tag and secondly te. Remember to actually reindex the new index.
  3. In the PEOPLE database, create a new normal field of data type Text, call it name.word for example. The field will not actually contain any data so it is considered a dummy field.
  4. Create an index on the dummy field (this should be the primary indexed tag) and below it in the list of fields to be indexed, enter the tag of the main name field (usually BA). The index should be of the key type Free text and have a key size identical to the maximum length of the name field (yet maximally 100). So the index will contain two indexed tags: firstly your new tag and secondly BA. Remember to actually reindex the new index.
  5. The direct way to search the relevant linked fields in the catalogue via these remote indexed fields, is by using the indirection symbol ->, for example: http://ourinstitution.com/collection/wwwopac.ashx?database=Catalogue&search=creator-%3Ename.word=
    Rembrandt
    . (-%3E is the URL encoded -> indirection symbol.)

Use indirection in the <searchFields> list in adlibweb.xml, for enhanced simple searching

In the <searchFields> list per <databaseConfiguration> section in adlibweb.xml you can list the fields you would like to be able to search via a q= query, which is the typical, efficient way of performing a simple search in multiple fields at once, with the Adlib API. Using our new combined indexes and a special hierarchical notation of the <searchFields> list (available in the current version of wwwopac.ashx) makes sure that indirected searching will automatically be used to access the remote indexes from within the catalogue. So instead of using the following rather standard <searchFields> list for the COLLECT database:
<searchfields>
   <field>title</field>
   <field>creator</field>
   <field>object_category</field>
</searchfields>
you could now use:
<searchfields>
   <field>title</field>
   <field>creator
      <field>name.word</field>         
   </field>
   <field>object_category
      <field>term.word</field>        
   </field>
</searchfields>
or even more advanced, combining both enhancements described above:
<searchfields>
   <field>title</field>
   <field>people.link
      <field>name.word</field>         
   </field>
   <field>object_category
      <field>term.word</field>        
   </field>
</searchfields>