Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude search results 'created_by' #44554

Open
wants to merge 1 commit into
base: 5.2-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions administrator/language/en-GB/plg_finder_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ PLG_FINDER_QUERY_FILTER_BRANCH_P_ARTICLE="Articles"
PLG_FINDER_QUERY_FILTER_BRANCH_P_AUTHOR="Authors"
PLG_FINDER_QUERY_FILTER_BRANCH_S_ARTICLE="Article"
PLG_FINDER_QUERY_FILTER_BRANCH_S_AUTHOR="Author"
PLG_FINDER_CONTENT_FIELD_CREATED_BY_AUTHOR_LABEL="Include articles 'created by' (author's name)?"
PLG_FINDER_CONTENT_FIELD_CREATED_BY_AUTHOR_DESC="Switch to 'no' if you want to search only in article content ignoring the field 'created by' (author's name)."
12 changes: 12 additions & 0 deletions plugins/finder/content/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
<option value="language">PLG_FINDER_CONTENT_TAXONOMIES_LANGUAGE</option>
<option value="type">PLG_FINDER_CONTENT_TAXONOMIES_TYPE</option>
</field>
<field
name="include_created_by_author"
type="radio"
layout="joomla.form.field.radio.switcher"
label="PLG_FINDER_CONTENT_FIELD_CREATED_BY_AUTHOR_LABEL"
description="PLG_FINDER_CONTENT_FIELD_CREATED_BY_AUTHOR_DESC"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
</fields>
</config>
Expand Down
5 changes: 4 additions & 1 deletion plugins/finder/content/src/Extension/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ protected function index(Result $item)
$item->addInstruction(Indexer::META_CONTEXT, 'metakey');
$item->addInstruction(Indexer::META_CONTEXT, 'metadesc');
$item->addInstruction(Indexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(Indexer::META_CONTEXT, 'author');
// Include articles created by author
if ($this->params->get('include_created_by_author', true)) {
$item->addInstruction(Indexer::META_CONTEXT, 'author');
}
$item->addInstruction(Indexer::META_CONTEXT, 'created_by_alias');

// Translate the state. Articles should only be published if the category is published.
Expand Down