mirror of
				https://github.com/discourse/discourse.git
				synced 2025-02-25 18:55:32 -06:00 
			
		
		
		
	FIX: Topic.similar_to results in error if cooked raw is blank.
				
					
				
			This commit is contained in:
		@@ -597,12 +597,14 @@ class Topic < ActiveRecord::Base
 | 
			
		||||
        PrettyText.cook(raw[0...MAX_SIMILAR_BODY_LENGTH].strip)
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
      raw_tsquery = Search.set_tsquery_weight_filter(
 | 
			
		||||
        Search.prepare_data(cooked),
 | 
			
		||||
        'B'
 | 
			
		||||
      )
 | 
			
		||||
      if cooked.present?
 | 
			
		||||
        raw_tsquery = Search.set_tsquery_weight_filter(
 | 
			
		||||
          Search.prepare_data(cooked),
 | 
			
		||||
          'B'
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
      tsquery = "#{tsquery} & #{raw_tsquery}"
 | 
			
		||||
        tsquery = "#{tsquery} & #{raw_tsquery}"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    tsquery = Search.to_tsquery(term: tsquery, joiner: "|")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user