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

smart search - exclude "created by" from article results #40492

Closed
pixelhexe opened this issue Apr 27, 2023 · 1 comment
Closed

smart search - exclude "created by" from article results #40492

pixelhexe opened this issue Apr 27, 2023 · 1 comment

Comments

@pixelhexe
Copy link

Steps to reproduce the issue

  1. You'll need some articles in your system to reproduce the issue. If not yet done, write some articles in your backend.
  2. Run the smart search indexer.
  3. Create a menu item with item type "Search".
  4. In frontend search for your user name (name of the author of the articles).

Expected result

Search in frontend should only give results of articles (if plugin "smart search - content" is activated as an example) in which the name of the author is in the title or text of the article.

Actual result

Search in frontend shows all articles which are written by this user/author.

Deselecting the Authors in Content Maps of Smart Search (in backend) does not help.

System information (as much as possible)

Joomla! 4.3.0
(but it is an old issue)
PHP 8.1

Additional comments

A few years old but seems not to be solved yet, see:

Core hack (not advisable of course) is to comment out some rows in this file
plugins\finder\content\src\Extension\Content.php
(earlier than J 4.3.0 it was in the file plugins\finder\content\content.php):

=> function index(Result $item)

$item->metaauthor = $item->metadata->get('author');
$item->addInstruction(Indexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(Indexer::META_CONTEXT, 'author');
$item->addInstruction(Indexer::META_CONTEXT, 'created_by_alias');

// Add the author taxonomy data.
        if (!empty($item->author) || !empty($item->created_by_alias)) {
            $item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author, $item->state);
        }

Then start the indexer and you are good => search in frontend will give the expected results, without searching for the name of the person who had written the article.
Probably it would be similar in the other smart search plugins, not only in content search.

An additional option in search menu item would be very helpful: exclude "created by"/"created by alias" from search results.

@Hackwar
Copy link
Member

Hackwar commented May 8, 2023

Here is a PR for that, waiting to be tested for 1.5 years.
#36867
Related as well: #39961
Related as well: #39751

Since we have a PR, I'm closing this issue.

@Hackwar Hackwar closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants