Language Change ? ? Pending

User tests: Successful: Unsuccessful:

avatar sakiss
sakiss
17 Feb 2021

Summary of Changes

The PR allows the use of images in the finder's results.

A new setting was added named "Result Image" both in the com_finder's (aka Smart Search) configuration and it's respective "search" menu item.

Testing Instructions

  1. Go to the "Smart Search" component, press the "Clear Index" button and then the "Index".
  2. Press the "Options" button to load the configuration and enable the "Result Image" setting.
  3. Use the smart search in the site's front-end and check the returned articles that have "Intro Image" set.

Actual result BEFORE applying this Pull Request

Smart_Search_1

Expected result AFTER applying this Pull Request

Smart_Search2

Sidenotes

Atm only the com_content finder plugin uses the images API function. Support for the rest plugins will be added in a next PR.
No styling is added, though a new setting (Image class) is introduced, according to the setting of com_content's config.
If anyone thinks that additional styling should be applied, plz commit.

Documentation Changes Required

DKN

avatar sakiss sakiss - open - 17 Feb 2021
avatar sakiss sakiss - change - 17 Feb 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Feb 2021
Category Administration com_finder Language & Strings Front End Plugins
avatar sakiss sakiss - change - 17 Feb 2021
The description was changed
avatar sakiss sakiss - edited - 17 Feb 2021
avatar sakiss sakiss - change - 17 Feb 2021
The description was changed
avatar sakiss sakiss - edited - 17 Feb 2021
avatar sakiss sakiss - change - 17 Feb 2021
Title
Images in the Smart Search results
[4.0] Images in the Smart Search results
avatar sakiss sakiss - edited - 17 Feb 2021
avatar sakiss sakiss - change - 17 Feb 2021
The description was changed
avatar sakiss sakiss - edited - 17 Feb 2021
avatar sakiss sakiss - change - 17 Feb 2021
Labels Added: ? ?
avatar richard67
richard67 - comment - 17 Feb 2021

Code style still bad, using spaces for indentation, see here https://ci.joomla.org/joomla/joomla-cms/40181/1/6 .

Another thing is that 4.0 is already in Beta phase so we have a feature freeze, and this here is a new feature.

So this PR should be made for the 4.1-dev branch.

avatar ceford
ceford - comment - 18 Feb 2021

I see the Intro image in the results list but in one instance followed by an error panel starting:

( ! ) Notice: Undefined variable: extraAttr in /Users/ceford/Sites/joomla-cms-4/components/com_finder/tmpl/search/default_result.php on line 96


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32450.

avatar brianteeman
brianteeman - comment - 18 Feb 2021

Just to be 100% clear. The decision was not to remove all descriptions. The decision was to display descriptions on screen instead of as a popup and only to include descriptions that it was felt were essential.

avatar richard67
richard67 - comment - 18 Feb 2021

@brianteeman Thanks for clarifying and explaining it more precise than I did. It's exactly like you say.

avatar richard67
richard67 - comment - 18 Feb 2021

Now the problem remains that if this is a new feature then it should go into 4.1.

@zero-24 What's your opinion?

avatar sakiss
sakiss - comment - 18 Feb 2021

Just to be 100% clear. The decision was not to remove all descriptions. The decision was to display descriptions on screen instead of as a popup and only to include descriptions that it was felt were essential.

Thanks for clarifying @brianteeman.
Then the addition of a description in a "vague" field name abides with the taken decision. Right?
Of course the answer is subjective to how someone perceives something as vague. But this by no means can be taken as inconsistency.

avatar zero-24
zero-24 - comment - 18 Feb 2021

Now the problem remains that if this is a new feature then it should go into 4.1.

@zero-24 What's your opinion?

That question should be directed at @bembelimen but i personally would agree to move this to 4.1

avatar chmst
chmst - comment - 18 Feb 2021

Everyting what is a nice idea and improvement, but does not fix a bug should be 4.1. as we did for example with my pr #32223

avatar sanek4life
sanek4life - comment - 18 Feb 2021

@sakiss thanks for your code! I originally wrote about this idea #27815, but it was closed.

avatar humblehumanbeing
humblehumanbeing - comment - 20 Feb 2021

Sometimes we need to use full article image instead of intro article image. I think this pr should check for full article image also if intro images does not exist.

avatar ceford ceford - test_item - 20 Feb 2021 - Tested successfully
avatar ceford
ceford - comment - 20 Feb 2021

I have tested this item successfully on 50afef0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32450.

avatar mateoAdi mateoAdi - test_item - 2 Apr 2021 - Tested successfully
avatar mateoAdi
mateoAdi - comment - 2 Apr 2021

I have tested this item successfully on 50afef0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32450.

avatar richard67 richard67 - change - 2 Apr 2021
Title
[4.0] Images in the Smart Search results
[4.1] Images in the Smart Search results
avatar richard67 richard67 - edited - 2 Apr 2021
avatar richard67
richard67 - comment - 2 Apr 2021

I've rebased this PR to 4.1-dev and adjusted the title accordingly.

As this PR has 2 good tests and the rebase was clean without any conflicts, this PR can be set to RTC.

avatar richard67 richard67 - change - 2 Apr 2021
Status Pending Ready to Commit
Build 4.0-dev 4.1-dev
avatar richard67
richard67 - comment - 2 Apr 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32450.

avatar sakiss
sakiss - comment - 31 Aug 2021

Could you please merge that?

avatar richard67
richard67 - comment - 31 Aug 2021

Could you please merge that?

Me not because I have set RTC. It's on the release lead @bembelimen to decide.

avatar HLeithner
HLeithner - comment - 31 Aug 2021

@sakiss could you reduce the complexity or explain why you need setter and getter and an object?

I would suggest to remove them and simple add 2 parameter imageUrl and imageAlt.

avatar Fedik
Fedik - comment - 31 Aug 2021

I agree with @HLeithner, it enough just

$result->image = 'fobar/blabla.jpg'
$result->imageAlt = 'bla';

this already handled by setElement()

/**
* The magic set method is used to push additional values into the elements
* array in order to preserve the cleanliness of the object.
*
* @param string $name The name of the element.
* @param mixed $value The value of the element.
*
* @return void
*
* @since 2.5
*/
public function __set($name, $value)
{
$this->setElement($name, $value);
}

and do not require set/get Image.

When rendering you just do:

if ($this->result->image)
{
   //... render image
}
avatar bembelimen
bembelimen - comment - 31 Aug 2021

Thanks @sakiss for this PR. I really like it but @HLeithner and @Fedik have a point there. If you add this and probably also do a bit styling for the output (float?) it's good to go.

f3f8b70 1 Sep 2021 avatar sakiss CS
e6d833e 1 Sep 2021 avatar sakiss Tabs
avatar sakiss sakiss - change - 1 Sep 2021
Labels Added: ? Language Change ? ?
Removed: ? ?
avatar Fedik
Fedik - comment - 1 Sep 2021

please also remove properties, it already handled by __get/__set methods,
see my previous comment

avatar sakiss
sakiss - comment - 1 Sep 2021

@bembelimen Unfortunately i am not aware of BS5 and the classes that J4 uses in general. I would appreciate it, if someone more knowledgable on that, have a look. Btw. The image uses the "Image Class" property/setting, which was introduced for the joomla content as well (not sure if this is still valid) and is supposed to provide the styling to the image.

avatar Quy Quy - change - 1 Sep 2021
Status Ready to Commit Pending
avatar Fedik
Fedik - comment - 1 Sep 2021

You mean to get/set the image properties using the __get/__set functions?

Correct, please read the comment for the method:

/**
* The magic set method is used to push additional values into the elements
* array in order to preserve the cleanliness of the object.
*
* @param string $name The name of the element.
* @param mixed $value The value of the element.
*
* @return void
*
* @since 2.5
*/
public function __set($name, $value)
{
$this->setElement($name, $value);
}

Then we will have consistency. This allows us to add any extra value to the result object, without introducing extra properties and getters/setters, for each.

avatar sakiss sakiss - change - 1 Sep 2021
Labels Removed: ?
avatar sakiss sakiss - change - 1 Sep 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-09-01 15:29:33
Closed_By sakiss
avatar sakiss sakiss - close - 1 Sep 2021
avatar richard67
richard67 - comment - 1 Sep 2021

@sakiss You've closed this by purpose or by accident?

avatar sakiss
sakiss - comment - 1 Sep 2021

@richard67 on purpose for obvious reasons

Add a Comment

Login with GitHub to post a comment