|
08-25-2005, 08:02 AM | #1 |
Green Mole
Join Date: Aug 2005
Posts: 5
|
partial/wildcard word searching
I'd like to be able to retrieve all words matching the text I provide e.g. strdup should match pstrdup, apr_pstrdup, etc.
Is this possible with the existing code? or do I need to start hacking the SQL statements? Rachel |
08-26-2005, 08:52 PM | #2 |
Head Mole
Join Date: May 2003
Posts: 2,539
|
Try editing search_function.php like so:
Code:
$like_start = array( "start" => "%", // is empty "any" => "%", // was a percent "exact" => "%" // is empty );
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension. |
08-27-2005, 03:10 AM | #3 |
Green Mole
Join Date: Aug 2005
Posts: 5
|
Thanks for that. That seems to get the right search results.
Now, next question, the text tag is showing highlighted results in the search results for those pages where it found an exact match, but not where it found a partial match. For those, I just get the first few lines of the page displayed. Is there a similar change I need to make for the partial matches to be highlighted too? Rachel |
08-27-2005, 09:28 AM | #4 |
Head Mole
Join Date: May 2003
Posts: 2,539
|
In search_function.php find:
Code:
switch($option) { case 'any': $reg_strings = "($stop_regs{1}|^)($reg_strings)()"; break; case 'exact': $reg_strings = "($stop_regs{1}|^)($reg_strings)($stop_regs{1}|\$)"; break; default: $reg_strings = "($stop_regs{1}|^)($reg_strings)()"; } Code:
switch($option) { case 'any': $reg_strings = "()($reg_strings)()"; break; case 'exact': $reg_strings = "($stop_regs{1}|^)($reg_strings)($stop_regs{1}|\$)"; break; default: $reg_strings = "()($reg_strings)()"; }
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension. |
08-27-2005, 09:36 AM | #5 |
Green Mole
Join Date: Aug 2005
Posts: 5
|
perfect!
thanks for the quick reply... Rachel |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Only searching from start of word | benklocek | Troubleshooting | 1 | 03-18-2005 01:14 PM |
Indexing "<word>-<word>"? | FaberFedor | How-to Forum | 23 | 02-28-2005 03:35 AM |
Wildcard for banned external links? | Slider | How-to Forum | 5 | 12-19-2004 08:07 AM |
serach more than one word | jjpcoca | How-to Forum | 1 | 06-19-2004 05:42 AM |
What's in a word for 1.8.0? | renehaentjens | How-to Forum | 10 | 02-18-2004 03:37 AM |