Skip to content

Search methods

Philip Cooksey edited this page Apr 12, 2020 · 4 revisions

Multiple search fields are combined together to find the intersection of the bibtex entries. If the value(s) being searched are not in a bibtex entry then it is hidden from view.

We define a search field with the class bibtex_search. Add options with values to be searched. The values are interpreted using regular expressions i.e., Multi-robot|multirobot|soccer finds the OR of the three strings. Regular expressions can only find the combination of bibtex entries rather than their intersection.

<select class="bibtex_search">
  <option value="">Search Topic</option>
  <!-- Add topic values here -->
  <option value="Robot Soccer">Robot Soccer</option>
  <option value="Multi-robot|multirobot|soccer">Multirobot Systems</option>
  <option value="Best Paper Award">Best Paper Award</option>
</select>

Generate Search Options

Adding the class bibtex_generate_author will generate the author list within the select tags. The extra attribute defines that it will only be the first authors (can be removed for all authors). The search attribute defines that this search will only check the bibtex field author (results in a quicker search). The search can be changed to any field in the bibtex entries.

<select class="bibtex_search bibtex_generate_author" extra="first" search="author">
  <option value="">Search First Author</option>
</select>

Any bibtex field can be used to generate lists. Also the information is gathered from the bibtex entries displayed (hidden or visible) on the webpage and not the information found in the bibtex file. This is critical because if you do not put the information into the template then you will not be able to generate the list for that entry name.

<select class="bibtex_search bibtex_generate_{bibtex entry name}" search="{bibtex entry name}">
  <option value="">Search {bibtex entry name}</option>
</select>

Sorting

The sorting uses the localeCompare javascript function. If you'd like to change the sorting use the following attributes:

  1. bibtex_sort_language sets the language preference for sorting.
  2. bibtex_sort_options supports any of the optional parameters that localeCompare takes, provided in a comma separated list of variable:value.

Example:

<!-- Sorting by the Swedish language -->
<select class="bibtex_search bibtex_generate_author"
            search="author" bibtex_sort_language="sv">
      <option value="">Search Author</option>
</select>

<!-- Sorting by numeric values rather than letters -->
<select class="bibtex_search bibtex_generate_title"
            search="title" bibtex_sort_options="numeric: true">
      <option value="">Search Title</option>
</select>

Splitting up a BibTeX field using custom separator

Let's say you have a BibTeX field with keywords separated by commas. If you want to generate a list of keywords from this field, you would use the bibtex_split_by field as shown in the example below:

<!-- Generate a list of keywords from BibTeX field -->
<select class="bibtex_search bibtex_generate_{keywords}"
            search="{keywords}" bibtex_split_by=", ">
      <option value="">Keywords</option>
</select>

Of course you don't need to set any of these extra attributes if you just want the default behavior.

Search bar

Adding the bibtex_search class to an input tag allows the user to search anything. The values are split up by spaces and then each is interpreted as a regular expressions.

<input type="text" class="bibtex_search" id="searchbar" placeholder="Search publications">

TODO: Fill out details on using the search bar

Hide information

If there is a bibtex entry value that should not be searched then add the class noread.

<span class="bibtexraw noread"></span>