First match of synonym rather than first match in text

LinL - August 25, 2009 - 18:15
Project:Glossary
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I've been using the Glossary module for a while and have about 300 terms, many with 3 or 4 synonyms.

Until this morning I was showing "All matches" and everything was working perfectly. Now I've changed the settings in my glossary filter from "All matches" to "Only the first match" and hit a problem. Hopefully this example will illustrate it:

Term name:
Full Name and other bits

Synonyms:
Full Name
Full Name and a different bit

Node body text:
........ Full Name and other bits ...... (the first place any variation of this term is mentioned)

I expected the entire string "Full Name and other bits" to be highlighted with a glossary link, but only "Full Name" is highlighted. Looking at the code, it is the first term/synonym found from the synonym list that is matched not the first occurrence of any variation of the term in the node body text, which seems the wrong way round.

I'm using 6.x-1.x-dev from 2009-Jan-20.

#1

LinL - August 29, 2009 - 14:02
Status:active» needs review

Attached is a patch for this against 6.x-1.x-dev version from 2009-Jan-20.

If "Only the first match" is set, it now checks for the first occurrence in the text of any of the term's synonyms, rather than matching the first found in the synonym list.

AttachmentSize
glossary-firstmatch.patch 1.96 KB
 
 

Drupal is a registered trademark of Dries Buytaert.