Question related to "Match whole words only"

Question related to "Match whole words only"

by Michael Otto -
Number of replies: 4
All 

Q: I would like to use the Glossary to search on exact terms based on the title of the CONCEPT field, NOT every time the term is mentioned in the definition field for any other entry. 

We have HUNDREDS of terms... when students query them - lets say they query the term "attack" ... EVERY ENTRY with that term will display... NOT JUST THE EXACT ENTRY FOR THAT TERM. In other words - JUST the exact entry with that exact string value as the stated in the CONCEPT FIELD for that term or phrase of the glossary, NOT EVERY ENTRY WHERE THE TERM IS MENTIONED IN THE DEFINITION OF ANOTHER TERM... 

The way the glossary currently works is contradictory to how humans actually use a real life glossary... in real life, they go look up the term exactly relative to what Moodle considers the CONCEPT FIELD. They don't and ask the glossary to barf out every reference to the mention of that term in the contents of EVERY ENTRY.

So, I want to eliminate this design flaw by using what I think was a feature implemented to mitigate the problem, Match whole case words - from https://docs.moodle.org/403/en/Using_Glossary:

"Match whole words only

If automatic linking is enabled, then turning this setting on will force only whole words to be linked. For example, a glossary entry named "construct" will not create a link inside the word "constructivism".

Click Save changes to save your entry."

Fine. Sounds like that if I check this box for the concept, the term ATTACK will NOT show up when I query anything with the term ATTACK nested in it OR any aspect of the definition, including and especially the content as listed in the definition field of other terms. 

Am I wrong? If so, please help me understand, because it does not seem to be working that way



Average of ratings: -
In reply to Michael Otto

Re: Question related to "Match whole words only"

by Michael Otto -
I think I have some idea WHY this may be happening

When I type in a string that SHOULD be concatenated with spaces added between terms, it breaks up the query into querying for each term! (WHO DOES THIS IN REAL LIFE...???)

Anyways, e.g.

I search for the phrase "Guarding position" in the glossary, which has a discreet entry, with this exact string as the concept field, it returns ALL THE ENTRIES:

QUERY 1 - run a search for exact string "Guarding Positions" - return values 
AMEND
QUERY 2 - run a search for all references to the string "GUARDING" - return values
AMEND 
QUERY 3 - run a search for all references to the string "POSITION" - return values 
AMEND
RETURN OUTPUTS TO REQUESTOR

This is not at all how people use a glossary... I would love to turn this off... 
In reply to Michael Otto

Re: Question related to "Match whole words only"

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
I think you’re maybe getting confused between the auto-linking functionality and the search functionality.

The “Match whole words only” tickbox does what it says on the tin. It will link “Ice” as a concept but will not highlight that concept when the word justice is displayed. And it only highlights concepts, not content in the description.

With the Glossary auto-link filter, you can choose whether to highlight the first occurrence of the concept, or every occurrence.

The search functionality will search all of the glossary for occurrences of the concept word/phrase. It works more like the “index at the back” in the “how humans actually use a glossary” example you have given - ie. multiple occurrences will be shown. There is also a tick box under the (Glossary) search box which allows you to also search the full text of the entry (ie. concept and description).

The alphabetical index at the top (depending on how you set the Glossary up) allows someone to browse directly to an entry (again, using your example, more of a “I know what I’m looking for”).

The Global search takes things further and will search multiple contexts for the phrase, not just the glossary.

So - are you talking about Global search, the Glossary search, or the auto-link functionality? The “match whole words only” tickbox will have no affect on the Global or Glossary search functionality.
In reply to Jon Bolton

Re: Question related to "Match whole words only"

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Ah, I’ve just read through your other posts which added some context.

As you’ve noticed, unticking the “search full text” allows the search to function as you want it to. There is no setting to disable that tick box but you could change one line in the code - I think I saw elsewhere that you were self-hosting?

In mod/glossary/view.php - at line 387 for the 3.11.18 version, you should see…

387 /// Search box
388 if ($showcommonelements ) {
389     $fullsearchchecked = false;
390     if ($fullsearch || $mode != 'search') {
391         $fullsearchchecked = true;
392     }
394     $check = [
395         'name' => 'fullsearch',
396         'id' => 'fullsearch',
397         'value' => '1',
398         'checked' => $fullsearchchecked,
399         'label' => $strsearchindefinition
400     ];

If you change the true in line 391 to false that will untick the box by default.
Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Question related to "Match whole words only"

by Michael Otto -
YOU, SIR, ARE AN ABSOLUTE BRO!!!

That worked a treat to disable full text search... I had no idea where to go flick the switch on that boolean... THANK YOU.

Really appreciate it

1) Its all technically "self" hosted, just in a different cloud
2) I will look into the behaviours of the glossary and get back to you. There are some things that I find really odd in the logic... for example, the way the query takes a full string and breaks any terms into multiple queries....

Is there any more complete documentation on the auto linking capabilities that will help me discern whats going on without bothering the forum?

Thanks again!