PDA

View Full Version : Turn off ? wildcard for question mark search


jmoree
08-19-2007, 04:57 AM
Is there a way to turn off wildcards? Or at least where “?” cannot be used as one?

Issue:
www.askdusty.com
If you type in “kata” the search replies with a good response. But, if someone type in “What is Kata?” nothing comes back b/c it’s looking for a 6 letter word begging with ‘kata’.

Is there a way to turn that off? I tried putting “?” on the ignore list but that didn’t help. Suggestions?

Thanks,
Josh

Ray
08-20-2007, 01:02 AM
There is currently no built-in functionality to disable wildcard support.

If you are experienced with scripting, you can use Javascript to pre-process the search query (and strip out question marks, or even the words "what is", in your case), or modify our search script to do this. Note however, that we are unable to provide support for modified versions of our search scripts, so we only advise this for users who are familiar with PHP (or the corresponding scripting platform they are using).

wrensoft
08-20-2007, 04:05 AM
Maybe (as a rather poor workaround) you could add some HTML code to the page concerned like this,

<meta name="ZOOMWORDS" content="What is Kata_ is a Japanese word
describing detailed choreographed patterns of movements practiced either
solo or in pairs">



I think adding the underscore should allow the ? to match.

jmoree
08-20-2007, 04:50 PM
Thanks for the replys. I tired the "kata_" in the zoomwords but it didn't work. I actually even tried 'katas' in the zoomwords and 'kata?' didn't find it???

How would one go about changing the code to take out the "?"? I have a little experience with PHP but I couldn't seem to make it work right when I modified it. Any tips on what to change or look for?

Josh

Ray
08-21-2007, 04:13 AM
Thanks for the replys. I tired the "kata_" in the zoomwords but it didn't work. I actually even tried 'katas' in the zoomwords and 'kata?' didn't find it???

The underscore might not actually work, because it needs to be a word join character, and even then, since it is at the end of the word, it may get truncated.

"katas" however, should definitely match a search for "kata?". I would guess that you probably were indexing from the cache at this point and immediate changes were not being picked up. Check the option "Reload all files (do not use cache)" on the General tab of the Configuration window to prevent this from happening.

How would one go about changing the code to take out the "?"? I have a little experience with PHP but I couldn't seem to make it work right when I modified it. Any tips on what to change or look for?

Look for a block of code with the comment "Prepare query for search". Here, you would need to strip out the question mark from the $query variable. So something like the following might work:

$query = str_replace("?", " ", $query);

Note that this is untested, and just given as a simple tip. Again, if you are unfamiliar with these functions, or understand what it is doing, we would not recommend making changes to the search script.

We are considering making wildcards an optional feature in a future major release but that would be some time away.