Commit 028b12a1 authored by Mark Chao's avatar Mark Chao

ES: cover snippet description in title search

Reindexing required
parent 415e0840
--- ---
title: Include snippet description as part of snippet title search (when Elasticsearch is not enabled) title: Include snippet description as part of snippet title search (basic search).
merge_request: 25961 merge_request: 25961
author: author:
type: added type: added
---
title: Include snippet description as part of snippet title search (advanced search, Elasticsearch reindexing required).
merge_request: 26870
author:
type: added
...@@ -4,7 +4,7 @@ module Elastic ...@@ -4,7 +4,7 @@ module Elastic
module Latest module Latest
class SnippetClassProxy < ApplicationClassProxy class SnippetClassProxy < ApplicationClassProxy
def elastic_search(query, options: {}) def elastic_search(query, options: {})
query_hash = basic_query_hash(%w(title file_name), query) query_hash = basic_query_hash(%w(title description file_name), query)
query_hash = filter(query_hash, options) query_hash = filter(query_hash, options)
search(query_hash, options) search(query_hash, options)
......
...@@ -15,6 +15,7 @@ module Elastic ...@@ -15,6 +15,7 @@ module Elastic
:title, :title,
:file_name, :file_name,
:content, :content,
:description,
:created_at, :created_at,
:updated_at, :updated_at,
:project_id, :project_id,
......
...@@ -13,6 +13,7 @@ describe Elastic::Latest::SnippetInstanceProxy do ...@@ -13,6 +13,7 @@ describe Elastic::Latest::SnippetInstanceProxy do
id: snippet.id, id: snippet.id,
title: snippet.title, title: snippet.title,
file_name: snippet.file_name, file_name: snippet.file_name,
description: snippet.description,
content: snippet.content, content: snippet.content,
created_at: snippet.created_at, created_at: snippet.created_at,
updated_at: snippet.updated_at, updated_at: snippet.updated_at,
......
...@@ -131,6 +131,7 @@ describe Snippet, :elastic do ...@@ -131,6 +131,7 @@ describe Snippet, :elastic do
'file_name', 'file_name',
'content', 'content',
'created_at', 'created_at',
'description',
'updated_at', 'updated_at',
'state', 'state',
'project_id', 'project_id',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment