|
03-14-2005, 12:47 AM | #1 |
Green Mole
Join Date: Feb 2005
Posts: 2
|
How to specifiy whole words only in results
Hello
Is it possible to configure/specify that the search results text only contains full words rather than partial or truncated words? For example, a current client site under development returns: ...od practice... when the client would prefer to see: ...good practice... Apologies if I've missed something obvious in the docs/forum, but there you go. Jak/Schizmat |
03-15-2005, 09:39 AM | #2 |
Head Mole
Join Date: May 2003
Posts: 2,539
|
The following code, and possibly related code, would need to be modified in search_functions.php to cut on a space rather than take a substring:
Code:
// v.1.8.7 $extract_content = substr($extract_content,$first_bold_spot,max(SNIPPET_DISPLAY_LENGTH, 2 * strlen($query_string))); // v.1.8.8 RC1 $extract_content = mb_substr($extract_content,$first_bold_spot,$length_of_snip);
__________________
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. |
03-21-2005, 02:16 AM | #3 |
Green Mole
Join Date: Feb 2005
Posts: 2
|
Possible solution
Probably not the most elegant solution but, I added a line which seems to work:
$extract_content = substr($extract_content,$first_bold_spot,max(SNIPPET_DISPLAY_LENGTH, 2 * strlen($query_string))); //addition begins: $extract_content = substr($extract_content, strpos($extract_content, " ", 0) + 1, strrpos($extract_content, " ") - strpos($extract_content, " ", 0)); //addition ends $extract .= ' ...'.phpdigHighlight($reg_strings,$extract_content).'... '; This is in the search_function.php file only. As it works at the point of result output, I don't _think_ I need to change anything else? (I've increased snippet length to help with the context, but knowing this particular client I doubt they'll be happy anyway! *shrugs) Hope this is of use to someone. I guess that wrapping the line in an if statement and adding a config flag could allow this to be easily turn on and offable if it's a useful enough option... Last edited by schizmat; 03-21-2005 at 02:20 AM. |
Thread Tools | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Many words not indexed | darrenm | Troubleshooting | 1 | 07-29-2005 08:54 AM |
dig for certain words | nmott | How-to Forum | 1 | 02-26-2005 08:02 PM |
Common Words - danish | kristian | Mod Submissions | 0 | 02-03-2005 12:52 AM |
index all words | Dreamory | How-to Forum | 0 | 10-22-2004 05:34 AM |
How To Index One-Character Words | vinyl-junkie | How-to Forum | 2 | 01-19-2004 11:08 AM |