Hey OLD RMN,
Thanks for replying to my post. Your suggestions led me to this post that actually seems to fix the problem.
http://forum.coppermine-gallery.net/index.php/topic,34219.msg160066.html#msg160066the code switch that nibbler recommends in the include/search.inc.php file works
change
if (in_array($param, $allowed))$fields[] = "$param LIKE '%$word%'";
to this
if (in_array($param, $allowed)) $fields[] = $param == 'keywords' ? "CONCAT(' ', $param, ' ') LIKE '% $word %'" : "$param LIKE '%$word%'";
But this fix only applies to the words in your "keywords" field and not the title or caption fields.
My advanced search was set so that the Title, Caption and keywords were all 'checked' by default. So I simply changed that on the search.php page so that only the keywords field was 'checked' by default. The search will still pick up fragments of search words in the title and caption of your images, but only if those checkboxes are checked by your users. Most people start with the default search when searching...so they may never even check any of the other boxes if they find what they are looking for. I don't know how to add the other two fields to this code above, although it can probably be done easily by someone knwledgable about the code. Below is my workaround to change the default of the search page to search the keywords only until someone can help with the code to include the other fields. If I get time, I will play around with the code. If I figure it out, I will post it here.
To change the default settings of your search page so that only the keywords checkbox is checked by default, find search.php in your root coppermine gallery. First, make a copy of it in case you need to go back to it.
You basically want to "uncheck" the checkbox for title and for caption and only leave keywords checked.
Here's the code to look for and change in search.php:
<tr>
<td><input type="checkbox" name="title" id="title" class="checkbox" checked="checked" /><label for="title" class="clickable_option">{$lang_adv_opts['title']}</label></td>
<td align="right">{$lang_search_php['newer_than']} <input type="text" name="newer_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
</tr>
<tr>
<td><input type="checkbox" name="caption" id="caption" class="checkbox" checked="checked" /><label for="caption" class="clickable_option">{$lang_adv_opts['caption']}</label></td>
<td align="right">{$lang_search_php['older_than']} <input type="text" name="older_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
</tr>
change the above code to:
<tr>
<td><input type="checkbox" name="title" id="title" class="checkbox" /><label for="title" class="clickable_option">{$lang_adv_opts['title']}</label></td>
<td align="right">{$lang_search_php['newer_than']} <input type="text" name="newer_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
</tr>
<tr>
<td><input type="checkbox" name="caption" id="caption" class="checkbox" /><label for="caption" class="clickable_option">{$lang_adv_opts['caption']}</label></td>
<td align="right">{$lang_search_php['older_than']} <input type="text" name="older_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
</tr>
Then a search for "car" will no longer find "cartoons" and "carnival"
If nibbler can help with the code to make this work in all the search fields (i.e title and caption and user fields) then that would be even better. But for now, I simply am adding my title and caption terms into my keywords.
My test gallery is at
http://www.birdmarks.com/coppermineThere are only bogus test words in there now.
If you type in "deer" into my default search you get 4 results. These 4 images have "deer" in their keywords. But if you type in "dee" you get NO results.
Now, If you go into the advanced search and check the "title" box (and keywords) you get 5 results. I have "deer" in the title of one image.
Further, in the advanced search, if you check "title", caption" and "keywords" you get 6 results as I have "deer" in one caption as well.
But, if you do a search for "dee" while the title and caption box are checked, you get 2 results, the one with "deer" in the title and the one with "deer" in the caption.
So the best thing would be if someone could tweak the above code to include those other fields. I'm sure it can be done, and is probably a simple tweak if you know what you are doing. But in the meantime, the code works great for the keywords field.