taxonomy splits keywords only on commas and ignores the biblio setting for the keyword separator

jonmower - May 25, 2007 - 11:56
Project:Bibliography Module
Version:6.x-1.0-rc5
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

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.

#1

rjerome - May 25, 2007 - 12:53

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

Ron.

#2

rjerome - May 25, 2007 - 12:57

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.

#3

jonmower - May 25, 2007 - 15:20

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

#4

jonmower - May 25, 2007 - 16:59

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?

#5

jonmower - May 25, 2007 - 17:03

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

seems like a bug

#6

rjerome - May 25, 2007 - 17:10

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.

#7

jonmower - May 25, 2007 - 20:12

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.

#8

rjerome - May 31, 2007 - 00:49

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

Ron.

#9

jonmower - June 18, 2007 - 14:51

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

#10

rjerome - June 18, 2007 - 20:56

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.

#11

jonmower - June 18, 2007 - 21:06

PHP 4.4.7

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

#12

rjerome - June 18, 2007 - 21:13

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.

#13

rjerome - June 18, 2007 - 21:15

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

#14

jonmower - June 18, 2007 - 21:23

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)

#15

rjerome - June 19, 2007 - 01:19

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.

#16

jonmower - June 19, 2007 - 01:38

caching is disabled

#17

rjerome - June 19, 2007 - 01:57

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.

#18

jonmower - June 19, 2007 - 02:39

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

#19

rjerome - June 19, 2007 - 12:40

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.

#20

jonmower - June 19, 2007 - 15:37

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.

#21

rjerome - June 19, 2007 - 16:26

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.

#22

gustav - April 24, 2008 - 13:06
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 request» bug report
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?

#23

Summit - November 27, 2008 - 08:31
Version:5.x-1.x-dev» 5.x-1.9

Subscribing, greetings, Martijn

#24

phil.cryer - February 19, 2009 - 20:43
Version:5.x-1.9» 6.x-1.0-rc5

Subscribing as well, thanks.

#25

rjerome - February 19, 2009 - 21:13

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.

#26

pimousse98 - April 16, 2009 - 04:52

subscribing. Thanks.

#27

toastncheez - October 23, 2009 - 16:56

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;
}

#28

rjerome - October 23, 2009 - 17:10

Right you are.

Thanks,

Ron.

 
 

Drupal is a registered trademark of Dries Buytaert.