The OpenScience Laboratory The Open University

iSpot Forum

Naming problem (and padding characters as demanded to meet the minimum count))

The ID here had failed to link:

Before I added a comment on how to fix it, I thought to test that the Brave New Dictionary knows about Polygonia c-album.
This was what I repeatedly found (independent of how far into the full name I typed):


But if I typed “Comma” into the common name box, up popped Polygonia c-album.
I suspect Charlotte had the same problem.

Yes, I’m getting the same. Type up to the end of polygonia and you can clearly see Polygonia c-album in the list, but as soon as you type the “space c” it vanishes. Very odd! This functionality is provided by part of Angular, the JavaScript framework that builds all of iSpot’s forms (and the vast majority of pages) and we’re currently in the process of getting all of that updated. Hopefully the newer version will work better.

I suspect that the hyphen breaks that script, but I can’t immediately see why.

You can type Bet pen, and it will bring up Betula pendula. Generally it seems to look for each “word” of the search term in each word of the name. I can well believe that the scripts’ interpretation of word is a string of letters, so “c-album” is two words, rather than one. But I don’t immediately see how that results in them breaking when you enter the “c”.

Clever stuff. If it filters out all punctuation - and I rather expect it would - it would never find the c-album. But at least you do get to see the options in the selector.

Further speculation. I would expect that Angular uses String.search(). If it looks for strings of “word” (\w) characters delimited by “space” (\s) (or start/end of string) then when it pulls the words of the name out of the string it won’t find “c-album” or “c” or “album” as the hyphen is neither a word character (letters, numbers and underlines) nor a space character.

I’d be looking for a search pattern on the lines of [^\s]\w*[\s$].