Adding new searchable fields

From DLXS Documentation

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
= Overview =
= Overview =
-
A basic set of fields has been declared in the file [bib.map <tt>bib.map</tt>] and these can be used along with [../../collmeta/collmgr.html collmgr] to enable or turn on searches for those fields. The basic fields currently include:
+
A basic set of fields has been declared in the [[bib.map]] file and these can be used along with [../../collmeta/collmgr.html collmgr] to enable or turn on searches for those fields. The basic fields currently include:
* <tt>author</tt>
* <tt>author</tt>

Revision as of 13:38, 9 September 2007

Overview

A basic set of fields has been declared in the bib.map file and these can be used along with [../../collmeta/collmgr.html collmgr] to enable or turn on searches for those fields. The basic fields currently include:

  • author
  • title
  • entire record
  • publisher
  • place of publication
  • year (i.e., date of publication)
  • series
  • notes
  • collection (i.e., collection ID)
  • format (e.g., HTML)
  • type (e.g., text)
  • language
  • id (i.e., the ID of the record)
  • dt (i.e., the OAI-specified date of last update for a record)

and all are based on encoding that conforms to the [dtd.html bib.dtd].

It may be necessary to define additional fields or to substitute values (based on different encoding practices) for the values used in this bib.map. This section outlines the steps necessary to create a new map file, and the steps in the collmgr needed to take advantage of these new (i.e., additional or different) fields.

Creating and Modifying the map File

Rather than modifying the file bib.map, a new map file should be created for each collection. The file bib.map and the new map file you will create are (or will be) located in the /{DLXSROOT}/misc/b/bib/maps directory. For the purposes of this documentation, we will use the example "patent.map" for a hypothetical collection with the collection ID "patent". For more information, go to [../../collmeta/maps.html a generic overview of map files].

Each mapping element in a map file consists of the following:

label
This element determines what will display in the user's browser when constructing searches, and is case sensitive. It must match the value used in the collmgr ([#collmgr see below]).
synthetic
This element determines the variable name that is used in the cgi.
native
The "native" element provides an appropriate XPAT search that the system will use to discover the appropriate content. The search may be simple (e.g., region YR) or complex (e.g., (region origin within region citation) + (region publish within region citation))
nativeregionname
This element is not used by BibClass and so content within the element may be omitted.
summarylabel
This element determines what will display in the user's browser when reporting the search and corresponding results, and is frequently used to declare an abbreviation such as "date" for "date of publication".

Create the file patent.map with any standard text editor and copy the contents of bib.map to it. Each map file consists of a section of "operator" mappings (e.g., ), followed by a section of "region" mappings; each section is introduced by a comment such as <!-- operator mapping -->. An example of an operator mapping is as follows:


<mapping>
   <label>And</label>
   <synthetic>AND</synthetic>
   <native>^</native>
</mapping>

Operator mappings use the synthetic element in BibClass; region mappings do not.

Begin by removing all mapping groups that are not relevant to your collection. For example, let us say that our example collection, patent, consists of records without authors; in this case, we would remove the region mapping for author that looks like this:


<mapping>
   <label>author</label>
   <synthetic></synthetic>
   <native>region L</native>
   <nativeregionname></nativeregionname>
   <summarylabel>au</summarylabel>
</mapping>

Next, add new mappings for the fields that you would like to make searchable in the interface. (Remember, each BibClass record will typically be searchable across all fields by using the mapping entire record, which is mapped to region A.) In the following three examples, we declare (1) a new, simple field based on a single element, (2) a re-mapping of an element already declared for BibClass, and (3) a new element based on the combination of two complex searches:

<mapping>
   <label>patent number</label>
   <synthetic></synthetic>
   <native>region PATNO</native>
   <nativeregionname></nativeregionname>
   <summarylabel>patent #</summarylabel>
</mapping>
<mapping>
   <label>year</label>
   <synthetic></synthetic>
   <native>region YR within region citation</native>
   <nativeregionname></nativeregionname>
   <summarylabel>year</summarylabel>
</mapping>
<mapping>
   <label>data type</label>
   <synthetic></synthetic>
   <native>(region geoform within region citation) + (region formname)</native>
   <nativeregionname></nativeregionname>
   <summarylabel>data type</summarylabel>
</mapping>

collmgr Steps Needed to Support Additional Searchable Fields

You will need to have the colldb database point to your new map file, and to declare the new searchable fields for the user interface. First, in [../../collmeta/collmgr.html collmgr]'s map field, declare your map file (e.g., patent.map). Next, in collmgr's regionsearch field, add your searchable fields. These must correspond to the label elements in the mapping, described above.

You may also need to support searchable fields such as date of publication (e.g., for sorting) or ID (for record-oriented operations like using the bookbag), but not need to show these as being searchable in the user interface. In these cases, you should create mappings, but not declare the regions in collmgr.

Personal tools