Updated search indexer to split words better
Will now split up words based on more chars than just spaces. Not takes into account newlines, tabs, periods & commas. Fixed #531
This commit is contained in:
		
							parent
							
								
									87339e4cd0
								
							
						
					
					
						commit
						5fd04fa470
					
				| 
						 | 
				
			
			@ -382,11 +382,13 @@ class SearchService
 | 
			
		|||
    protected function generateTermArrayFromText($text, $scoreAdjustment = 1)
 | 
			
		||||
    {
 | 
			
		||||
        $tokenMap = []; // {TextToken => OccurrenceCount}
 | 
			
		||||
        $splitText = explode(' ', $text);
 | 
			
		||||
        foreach ($splitText as $token) {
 | 
			
		||||
            if ($token === '') continue;
 | 
			
		||||
        $splitChars = " \n\t.,";
 | 
			
		||||
        $token = strtok($text, $splitChars);
 | 
			
		||||
 | 
			
		||||
        while ($token !== false) {
 | 
			
		||||
            if (!isset($tokenMap[$token])) $tokenMap[$token] = 0;
 | 
			
		||||
            $tokenMap[$token]++;
 | 
			
		||||
            $token = strtok($splitChars);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $terms = [];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue