I'd like to have the option for the module to use semicolons instead of commas as it breaks the keyword field into distinct keywords. For example, I would like to use chemical names that include commas as keywords. Currently the name gets split up into several nonsensical keywords because of the commas.

Comments

rjerome’s picture

Shouldn't be a problem, I can put in a user definable option for that.

Ron.

rjerome’s picture

By the way, the way it works now is that it looks for different separators, first a semicolon then a comma and then a space, so if you had more than one keyword containing commas separated by semicolons, it would split on the semicolons, however if you just have one keyword containing commas that keyword would get split on the comma.

Ron.

jonmower’s picture

I'm always importing from Endnote and always use only semicolons as keywords separators, so that user definable option is what I need! Thanks

jonmower’s picture

I just noticed that "Henry's constant ensemble" was split into "Henry" and "s constant ensemble"

You didn't mention apostrophes as a separator. Are they being used or is this a bug?

jonmower’s picture

I was wrong. "Henry's constant ensemble" is split into "Henry" and "'" and "s constant ensemble"

seems like a bug

rjerome’s picture

I'm a bit surprised it split on the apostrophe, but none the less, this bit of code needs a little work and I think the first suggestion of a user defined character to split on will be the answer.

Ron.

jonmower’s picture

Just to make sure I'm being clear...it'd didn't split on the apostrophe by created two keywords one from before the apostrophe and one from after (like it would for a comma or semicolon). Instead, it creates three keywords: 1 from the text before the apostrophe, a second keyword that is the apostrophe itself, and a third keyword from the text after the apostrophe.

rjerome’s picture

This isn't user selectable yet, but it is now forced to split only on semicolons.

Ron.

jonmower’s picture

This isn't working for me. Keywords are stilling being split using commas rather than being forced to only use semicolons.

rjerome’s picture

Hmm, this is strange. What version of PHP are you using?

Could you check the first line of the biblio.module file to confirm the version and date?

Ron.

jonmower’s picture

PHP 4.4.7

biblio.module,v 1.36.2.101 2007/06/12 01:59:16

rjerome’s picture

Could you take a look in the database and see if in fact the keywords are actually separated by semicolons? I'm a little mystified as to why it would still be splitting on commas.

Ron.

rjerome’s picture

I just thought of another thing... Do you have any caching turned on in Drupal?

jonmower’s picture

I don't know anything about caching in drupal so presumably I don't have any turned on unless it's on by default

The example I just tried was to import a record in Endnote 8+ xml format with a single keyword 1,2-apple

That keyword was split into two: 1 and 2-apple

If you want me to look in the database, give me the sql query to run via phpadmin (I'm pretty clueless about sql)

rjerome’s picture

I just entered that keyword (1,2-apple) on my development site and it works fine (doesn't split on the comma).

Check "admin/settings/performance" for cache settings.

Ron.

jonmower’s picture

caching is disabled

rjerome’s picture

I don't know what to say, I just down graded to php 4.x on my development machine and it still works.

Is there any chance that you have two "biblio/" module directories in your drupal tree? I just seems like your using an older version of the module.

Ron.

jonmower’s picture

Could this be another 5.1 vs 4.7 issue?

It's not working on my two 5.1 sites where biblio is installed

I just installed it on a 4.7 site and it works

rjerome’s picture

I've tried it on both 4.7 and 5.x (I do my primary development on 5.x and back port). Did you search the 5.x tree for duplicate biblio.module files? (this has happened to me before when I accidentally extracted the biblio archive in a directory where I had not intended and it took me a while to figure out why my changes were not taking affect)

Ron.

jonmower’s picture

Yes, I searched for a duplicate biblio.module and did not find one. If the problem is something I've done, it's probably something I've done intentionally since I have the same problem on both of my 5.1 installations.

I now see that it's not a problem with keywords. It's a problem with the taxonomy tags generated from the keywords. I had suppressed the display of keywords since the tags were being displayed also. I assumed that the tags and keywords were the same. I just re-enabled the display of keywords and see that the keyword doesn't split with the comma...only the tags do.

rjerome’s picture

So I guess that's a good news(for me)/bad news(for you) type scenario.

Glad we finally got to the bottom of it.

Ron.

gustav’s picture

Title: parse keywords using ; as divider instead of , » taxonomy splits keywords only on commas and ignores the biblio setting for the keyword separator
Category: feature » bug
Priority: Normal » Minor

I changed the title and reclassified this as a bug.

Apparently the biblio module does not register the keywords as taxonomy terms one-by-one but submits the whole string and of course the taxonomy module only splits keywords on commas. A partial solution would be to let the biblio module do the splitting first and then register the keywords individually as taxonomy terms. There is still the potential problem that taxonomy terms are not allowed to contain commas, but I don't think there will be many keywords that contain commas, so this is not a serious problem.

Why does the biblio module maintain its own Keywords field rather than always using the taxonomy module for this?

summit’s picture

Version: 5.x-1.x-dev » 5.x-1.9

Subscribing, greetings, Martijn

phil.cryer’s picture

Version: 5.x-1.9 » 6.x-1.0-rc5

Subscribing as well, thanks.

rjerome’s picture

If you want to enter a taxonomy term which contains a comma, you can just enclose the whole thing in double quotes and then separate the quoted portions with commas to retain the embedded comma

i.e. "1,2-apple", "1,2-orange"

will will not get split on the comma between the 1 and 2.

As for why not only use taxonomy, I took a brief foray down that road and discovered the very real possibility that keywords could get separated from the publication data or independently deleted, then you have lost part of your data. The only real way to maintain data integrity is to manage all the data internally.

pimousse98’s picture

subscribing. Thanks.

Anonymous’s picture

I'm not using taxonomies with this module, at the moment, but noticed there's a missing initialization of the keyword separator string with the biblio settings value, in biblio.pages.inc:_biblio_keyword_links:

function _biblio_keyword_links($keywords,$base='biblio') {
  $options = array();
  if (isset($_GET['sort'])) {
    $options['query']  .= "sort=" . $_GET['sort'];
  }
  if (isset($_GET['order'])) {
    $options['query']  .= $options['query'] ? "&" : "";
    $options['query']  .= "order=" . $_GET['order'];
  }
  $html = "";
  if (!is_array($keywords)) {
    require_once(drupal_get_path('module', 'biblio') .'/biblio.keywords.inc');
    $keywords = biblio_explode_keywords($keywords);
  }

  // added:
  $sep = variable_get('biblio_keyword_sep', ''); 

  foreach($keywords as $kid => $keyword ) {
    $html .= (empty($html))? "" : "$sep ";
    $html .= l(trim($keyword), "$base/keyword/$kid" , $options);
  }
  return $html;
}
rjerome’s picture

Right you are.

Thanks,

Ron.

bekasu’s picture

Status: Active » Closed (fixed)

marking this closed. The solution is to use double quotes and the most current version of biblio and drupal.
bekasu

tourendal’s picture

I am using spaces to separate keywords in my BibTeX files. This bug causes all my keywords to be mangled into one long string because the separator from Biblio is ignored.