Multi-select from existing keywords

  • izahn

    izahn - 2008-09-16

    I'm using refbase to manage references for a research group website. It's working very well, despite my inexperience with website design (I think refbase is achieving it's goal of being simple to use!).

    Because the website pages are generated using keywords (e.g., refs/show.php?keywords=education&...) keywords take on an especially important role. For example, someone may add a reference and put "learning" as the keyword, which means that the article will not show up on the education pages. It would be awesome if users could somehow see what other keywords already exist in the database so that they would know to use "education" instead of "learning". Ideally I would like a multi-select dropdown list of keywords in the "add reference" page. I'm assuming this would probably be difficult to do, but I thought I'd put the idea out there.

    Thanks so much for your work on refbase--I spent a lot of time looking at similar programs and refbase has been almost perfect.


    • Richard Karnesky

      Keywords are going to become more "tag-like" & there will eventually be a way of browsing records from a list of keywords.   We'll certainly consider enhancements to record entry as well.  I think that a select box is pretty limiting, but perhaps we can have something like keyword auto-completion on browsers with javascript.


    • Matthias Steffens

      Hi Ista,

      > It would be awesome if users could somehow see what other keywords
      > already exist in the database

      This is a good (and valid) feature request. It has been requested previously (in one form or another), see e.g.:

      and it is a planned feature:

      While this feature has been planned & discussed for quite some time now, unfortunately, nothing has been done to implement it yet. This is mostly since it's a rather complex feature that requires changes to the backend engine as well as to the interface. Another reason why this feature hasn't been implemented yet is that I'm lacking clear knowledge about how this could be done (using JavaScript etc) so that it works across all of the popular/recent browsers and doesn't interfere with browser-specific completion mechanisms. I should probably take some time to investigate the available JavaScript frameworks...

      I don't know if you (or your users) are assigning multiple keywords to each record, or if every record does only belong to one single keyword/category. If the latter, then a simple dropdown menu that would list all of the existing keywords might be an option. We do something similar in the 'simple_search.php' and  'advanced_search.php' pages.

      If you'd rather like to keep the 'keywords' field as a "free-style" text entry field, one could also re-use the 'area' field (which is originally meant as a special-purpose "keywords" field, e.g. to store the geographic or academic field of research), and modify it so that it offers the user to choose from a controlled list of subject headings. Then, you'd query the 'area' field instead of the 'keywords' field:


      One would need to add a dropdown menu to the "Add/Edit Record" mask of 'record.php', I'd be happy to help you with that if necessary.

      That said, I agree with you that a generic method to auto-complete field contents would be very useful. refbase has a hidden (since unfinished) "Browse view" feature which is meant to allow users to browse unique field contents. Checkout e.g. these queries:

      The "Search within Results" functionality (which already works!) makes this a very powerful & flexible feature. When completed, this feature could be re-used within a popup window, and some JavaScript magic could be used to insert (or append) the user's selection to the field that is currently selected in the "Add/Edit Record" mask of 'record.php'.

      Another option might be to develop a generic JSON API for refbase and have the refbase GUI query its JSON API in the background. Field values that match the user's current input would be presented in a dropdown menu below the current text entry field, and selected values would be added to the contents of the current field.

      Developing a generic JSON API wouldn't be too difficult (and may be desirable for other use cases as well). But I'd need some help (and/or time to learn) about the Ajax/GUI-related methods to build an interface that works reasonably well and across all recent browsers.


    • izahn

      izahn - 2008-09-17

      Thanks Rick and Matthias, that's very helpful. Sorry for not looking harder for this information before making a new post. I'm glad to see that this issue is being discussed already.

      My particular situation is complicated by the fact that I do need to use multiple values, because articles often belong to multiple categories (e.g., both "education" and "motivation"). For now I think what I'm going to do is just make a quick-and-dirty popup link to the browse view (I know it's not finished and is probably hidden for a reason, but the only people who will see to are the small handful of people authorized to create new records) so that people can (fairly) quickly see what keywords already exist. That way they can just copy-and-paste keywords from there.

      Thanks again,

    • Matthias Steffens

      Hi Ista,

      The Browse view feature is more or less functional. However, please note that fields which contain multiple items (e.g. multiple authors, keywords, languages, etc) are NOT splitted into their individual parts. As an example, say your 'keywords' field contains:

      education; learning; motivation

      Problems are that Browse view currently displays this string as is. Instead, it should display all of the contained keywords as *separate* rows, i.e. like this:


      So, while the Browse view feature is probably most useful for multi-item fields, it doesn't really work for these fields (yet).

      That said, there may be an alternative: Based on your feedback, I've implemented a feature that allows to query refbase for search suggestions. This feature is readily available in Firefox 2 or greater (see below), and it could form the basis for word completions in refbase text entry fields. I.e., the backend work is mostly done, "only" the GUI glue is still missing (which might be the tricky bit, though).

      If your people happen (or are willing) to use Firefox, then they could now use the search completion feature of the Firefox search box (in the browser's tool bar) to see all existing keywords that match a given string.

      To try this out:

      1. Open Firefox and goto

      2. Click on the arrow of the dropdown menu that's next to the search box in the browser's tool bar

      3. Select the entry that says: "Add refbase Beta database" (or the like); this will add to your saved search engines

      4. Type e.g. "keywords = mol" into the search box (without the quotes); Firefox should now display search suggestions for keywords that already exist in the refbase database; from my experience, search suggestions will display if you slowly type or delete characters at the end of the search string

      Note that this feature is based on the refbase OpenSearch[1] features, and that refbase supports (limited) CQL[2] queries in the query string.


      By default, the 'title' field will be searched, try e.g.:

      snow sea

      However, you can prefix your search term(s) with a refbase field name (e.g. 'keywords') and an OpenSearch relation (e.g. ' = ') to search another field instead.

      The "Help & Examples" section of:

      should give you a first overview about the CQL search syntax. The relations ' any ' (find any of the given words) and ' = ' (find only records where the given words appear in the given order with no others intervening) are probably most useful.

      In case of, checkout these example queries:

      author = Tho
      author any Tho Gra Kuh

      keywords = alg
      keywords any snow nutri

      abbrev_journal = J Med

      publication any Mar Ecol
      publication all Mar Eco

      title = case study
      title any genet abort tumor

      year = 2002
      year any 2001 2002
      year > 1998
      year < 1970
      year within 1978 1985

      issn = 07

      While this search suggestions feature doesn't give you suggestions right in the refbase text entry fields, it may serve as a good work around until there's something better.

      Let me know if you have any questions.

      Hope this helps,


    • Matthias Steffens


      > While this search suggestions feature doesn't give you suggestions
      > right in the refbase text entry fields, it may serve as a good
      > work around until there's something better.

      in addition to the previously described search suggestions feature that's available from the browser's search box (in FF or IE), the refbase interface now offers auto-completions (or search suggestions) in most of its text entry fields. This includes the "Add/Edit record" form ('record.php'). You can try this new feature at:

      This should address the original poster's feature request:

      > It would be awesome if users could somehow see what other keywords
      > already exist in the database so that they would know to use
      > "education" instead of "learning". Ideally I would like a
      > multi-select dropdown list of keywords in the "add reference" page.

      See below for some more detailed information about the auto-completion feature.

      HTH, Matthias


      The auto-completion feature in the "Add/Edit record" form also works with multi-item fields (such as 'author', 'keywords', 'place', 'language', 'user_keys', etc). I.e. if you type a semicolon and then type your next word, refbase will auto-complete that word but will leave existing items in place.

      Since auto-completions/search suggestions are provided via OpenSearch, refbase's OpenSearch search syntax can be used in search terms. I.e. you can use wildcards anywhere in a search term to match one (?) or more (*) unspecified characters. E.g.:


      Typing two wildcard characters (**) will show you all field contents (you need two chars since, currently, a minimum of two characters is required to start the auto-completion process).

      One can also use CQL anchor characters (^) to restrict searches to the beginning or end of the field. E.g.:


      Since refbase uses the CQL 'all' relation for auto-completions & search suggestions, typing multiple words (or parts of words) that are separated by a space will perform an 'AND' search. E.g.:

      necr tumor   (in 'title' field)
      Gran Kuo     (in 'author' field)

      Note that when entering multiple words in multi-item fields, only the first word will be auto-completed (while the other words function as restricting terms).

      Also note that the final search is still performed using SQL regular expressions (RLIKE), so this may be a source of confusion. This will improve when the entire refbase interface supports the CQL search syntax (which we've discussed previously).


Log in to post a comment.