Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Files:

The location of the files you'll want to edit depend on which version of DSpace you are using, as the location of the primary JSP folder has changed in DSpace over the years.

  • DSpace 3.0 or above
    • DSpace Config: [dspace]/config/dspace.cfg
    • Messages file: [dspace-source]/dspace-api/src/main/resources/Messages.properties
    • Advanced Search JSP: [dspace-source]/dspace-jspui/src/main/webapp/search/advanced.jsp
    /local
  • DSpace 1.5.0 through 1.8.2
    • DSpace Config: [dspace]/config/dspace.cfg
    • Messages file: [dspace-source]/dspace-api/src/main/resources/Messages.properties
    • Advanced Search JSP : [dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/ search/advanced.jsp
  • DSpace 1.4.2 and earlier versions
    • DSpace Config: [dspace]/config/dspace.cfg
    • Messages file: [dspace-source]/config/language-packs/Messages.properties
    • Advanced Search JSP: [dspace-source]/jsp/search/advanced.jsp

Instructions:

  1. Look for this line in dspace.cfg: ##### Fields to Index for Search #####
  2. Beneath it you will see several lines like this:

    Code Block
    search.index.1 = author:dc.contributor.*
    Code Block
    
    search.index.2 = author:dc.creator.*
    Code Block
    
    search.index.3 = title:dc.title.*
    Code Block
    
    search.index.4 = keyword:dc.subject.* 
    Code Block
    
    search.index.5 = abstract:dc.description.abstract 


  3. Add another search.index.# line to the bottom. If you just want to add a different Dublin Core ( Code Blockdc) field to one of the existing "named indices", use the models above as a guide. If you wish to specify a different metadata schema, replace Code Blockdcwith the other metadata schema's name.
    • The "name" to the left of the colon (e.g. author, title, keyword, etc) is important. In the above example, a search on "author" is specified to search all Dublin Core ( Code Blockdc) Code Blockcontributor and Code Blockcreator fields. Whereas, a search on "abstract" only searches the Code Blockdc.description.abstract field.
  4. If you want to add an entirely new search field, you will also have to modify Messages.properties (see Change

    +

    page

    +

    text (JSP)) to add a user-friendly label for it, and the advanced-search JSP (advanced.jsp) to add an appropriate

    Code Block
    <option>

    <option>element, as below:

    Code Block
    &lt;option<option value="author" &lt;%<%= field1.equals("author") ? "selected=\"selected\"" : "" %&gt;&gt;&lt;fmt%>><fmt:message key="jsp.search.advanced.type.author"/&gt;&lt;/option&gt; ></option>
    • The "value" attribute of your
      Code Block
      &lt;option&gt;
      <option> element should correspond to the name of one of your search indices (e.g. author, title, keyword, etc.)
  5. Perform the steps in Re-index DSpace .
  6. Perform the steps in Rebuild DSpace .

Notes:

  • In DSpace, the most confusing concept regarding search fields is the keyword search.
  • In the basic search boxes (as seen below), any terms entered are searched for anywhere within any of the search indices (i.e. any of the Code Blocksearch.index.# fields in dspace.cfg), or the full text of the document (if it is full-text indexable). These search boxes perform what most refer to as a keyword or keyterm search.
  • However, to make things a little confusing, you'll notice a keyword search index listed in dspace.cfg: Code Blocksearch.index.4 = keyword:dc.subject.* This (rather inappropriately named) index is actually used during subject specific searches (hence the Code Blocksubject.*). It does not have any control over a normal keyword search that is run from the basic search box in DSpace.