diff --git a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 index 0bc886a8178..07e0097b7c2 100644 --- a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 +++ b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 @@ -77,7 +77,8 @@ export default Em.Component.extend({ likes: false, private: false, seen: false - } + }, + all_tags: false }, status: '', min_post_count: '', @@ -230,13 +231,15 @@ export default Em.Component.extend({ const match = this.filterBlocks(REGEXP_TAGS_PREFIX); const tags = this.get('searchedTerms.tags'); + const contain_all_tags = this.get('searchedTerms.special.all_tags'); if (match.length !== 0) { - const existingInput = _.isArray(tags) ? tags.join(',') : tags; + const join_char = contain_all_tags ? ',' : '|'; + const existingInput = _.isArray(tags) ? tags.join(join_char) : tags; const userInput = match[0].replace(REGEXP_TAGS_REPLACE, ''); if (existingInput !== userInput) { - this.set('searchedTerms.tags', (userInput.length !== 0) ? userInput.split(',') : []); + this.set('searchedTerms.tags', (userInput.length !== 0) ? userInput.split(join_char) : []); } } else if (tags.length !== 0) { this.set('searchedTerms.tags', []); @@ -365,14 +368,16 @@ export default Em.Component.extend({ } }, - @observes('searchedTerms.tags') + @observes('searchedTerms.tags', 'searchedTerms.special.all_tags') updateSearchTermForTags() { const match = this.filterBlocks(REGEXP_TAGS_PREFIX); const tagFilter = this.get('searchedTerms.tags'); let searchTerm = this.get('searchTerm') || ''; + const contain_all_tags = this.get('searchedTerms.special.all_tags'); if (tagFilter && tagFilter.length !== 0) { - const tags = tagFilter.join(','); + const join_char = contain_all_tags ? ',' : '|'; + const tags = tagFilter.join(join_char); if (match.length !== 0) { searchTerm = searchTerm.replace(match[0], `tags:${tags}`); diff --git a/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs b/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs index 71a9c1b6198..b83baf1cc4c 100644 --- a/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs +++ b/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs @@ -41,12 +41,15 @@