Fix #hashtag matching non-hashtagged posts in search (#26781)
		
	This commit is contained in:
		
					parent
					
						
							
								a106c46478
							
						
					
				
			
			
				commit
				
					
						68b4e36c82
					
				
			
		
					 4 changed files with 44 additions and 12 deletions
				
			
		|  | @ -37,18 +37,29 @@ class PublicStatusesIndex < Chewy::Index | |||
|           english_stemmer | ||||
|         ), | ||||
|       }, | ||||
| 
 | ||||
|       hashtag: { | ||||
|         tokenizer: 'keyword', | ||||
|         filter: %w( | ||||
|           word_delimiter_graph | ||||
|           lowercase | ||||
|           asciifolding | ||||
|           cjk_width | ||||
|         ), | ||||
|       }, | ||||
|     }, | ||||
|   } | ||||
| 
 | ||||
|   index_scope ::Status.unscoped | ||||
|                       .kept | ||||
|                       .indexable | ||||
|                       .includes(:media_attachments, :preloadable_poll, :preview_cards) | ||||
|                       .includes(:media_attachments, :preloadable_poll, :preview_cards, :tags) | ||||
| 
 | ||||
|   root date_detection: false do | ||||
|     field(:id, type: 'long') | ||||
|     field(:account_id, type: 'long') | ||||
|     field(:text, type: 'text', analyzer: 'verbatim', value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: 'content') } | ||||
|     field(:tags, type: 'text', analyzer: 'hashtag', value: ->(status) { status.tags.map(&:display_name) }) | ||||
|     field(:language, type: 'keyword') | ||||
|     field(:properties, type: 'keyword', value: ->(status) { status.searchable_properties }) | ||||
|     field(:created_at, type: 'date') | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue