? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
18 Apr 2018

Pull Request for Issue #20175 .

Summary of Changes

give priority in content search result if the match is on the title field

Testing Instructions

do a search on content only
without patch see actual result
with patch see expected result

Expected result

When the keyword is matched on title the item ranks better in search result than text

Actual result

see #20175

Documentation Changes Required

?

thanks to @ggppdk for the feedback

avatar alikon alikon - open - 18 Apr 2018
avatar alikon alikon - change - 18 Apr 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2018
Category Front End Plugins
avatar alikon alikon - change - 18 Apr 2018
The description was changed
avatar alikon alikon - edited - 18 Apr 2018
avatar brianteeman
brianteeman - comment - 18 Apr 2018

AWESOME - tested on my blog (still enabled) and the search and replace article is now first on the list when you search for the word replace

Feel free to check it in action on my blog

!!!! THANK YOU !!!!

avatar brianteeman
brianteeman - comment - 18 Apr 2018

I have tested this item successfully on 120cb8e


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

avatar brianteeman brianteeman - test_item - 18 Apr 2018 - Tested successfully
avatar ReLater
ReLater - comment - 18 Apr 2018

I have tested this item ? unsuccessfully on 120cb8e

In some cases I get an error (system message) "An error has occurred."

When I debug it it is

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE WHEN LOWER(a.title) LIKE LOWER('%modulstil%') THEN 1 ELSE 0 END as priori' at line 1

It's thrown in this line: https://github.com/alikon/joomla-cms/blob/120cb8e84231a097482187faf613ffbcc8e262a3/plugins/search/content/content.php#L396

  • "Search archived" is actice in plg_search_content.

  • Search limit is set to 50.

  • I don't have any archived articles.

  • I searched for a word that exists in only 5 articles.

  • So, somewhere during search in/for archived articles the database query fails.


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

avatar ReLater ReLater - test_item - 18 Apr 2018 - Tested unsuccessfully
avatar ReLater
ReLater - comment - 18 Apr 2018

I don't know if it helps. This is the whole $query:

SELECT a.title AS title, a.metadesc, a.metakey, a.created AS created, CONCAT(a.introtext,a.fulltext) AS text, CASE WHEN CHAR_LENGTH(a.alias) != 0 THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) != 0 THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, c.title AS section, '2' AS browsernav  CASE WHEN LOWER(a.title) LIKE LOWER('%modulstil%') THEN 1  ELSE 0  END as priority
FROM #__content AS a
INNER JOIN #__categories AS c ON c.id=a.catid AND c.access IN (1,1)
WHERE ((LOWER(a.title) LIKE LOWER('%modulstil%') OR LOWER(a.introtext) LIKE LOWER('%modulstil%') OR LOWER(a.fulltext) LIKE LOWER('%modulstil%') OR LOWER(a.metakey) LIKE LOWER('%modulstil%') OR LOWER(a.metadesc) LIKE LOWER('%modulstil%'))) AND a.state = 2 AND c.published = 1 AND a.access IN (1,1) AND c.access IN (1,1) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2018-04-18 23:21:33') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2018-04-18 23:21:33')
ORDER BY priority DESC, a.created DESC
avatar alikon alikon - change - 19 Apr 2018
Labels Added: ?
avatar alikon
alikon - comment - 19 Apr 2018

thanks, i've forgotten the comma

avatar infograf768
infograf768 - comment - 19 Apr 2018

Looks like working here for Articles Titles priority when choosing only Articles in the filter.
If not using filters, then categories are displaying first (no priority to title there).

The ordering filter looks broken here.

avatar alikon
alikon - comment - 19 Apr 2018

Looks like working here for Articles Titles priority when choosing only Articles in the filter.

yes this is the fix, otherwise should work as before

to work with other filters too we need to discuss a little bit more before to submit a PR

avatar infograf768
infograf768 - comment - 19 Apr 2018

I confirm that before patch the ordering filter is also broken here. Test Oldest first or Newest first when all filters on, or only categories.
It is working though (before patch) for articles only.

EDIT: looked at the categories plugin and remarked that ordering code is quite different

		switch ($ordering)
		{
			case 'alpha':
				$order = 'a.title ASC';
				break;

			case 'category':
			case 'popular':
			case 'newest':
			case 'oldest':
			default:
				$order = 'a.title DESC';
		}

while we have for content

switch ($ordering)
		{
			case 'oldest':
				$order = 'a.created ASC';
				break;

			case 'popular':
				$order = 'a.hits DESC';
				break;

			case 'alpha':
				$order = 'a.title ASC';
				break;

			case 'category':
				$order = 'c.title ASC, a.title ASC';
				break;

			case 'newest':
			default:
				$order = 'a.created DESC';
				break;
		}

(First time I look at that code. It explains all)

avatar ReLater
ReLater - comment - 19 Apr 2018

I have tested this item successfully on 157eb0c


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

avatar ReLater ReLater - test_item - 19 Apr 2018 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 20 Apr 2018

This breaks expected ordering. It should be added as ordering option.

avatar infograf768
infograf768 - comment - 20 Apr 2018

This breaks expected ordering. It should be added as ordering option.

Agree. As I stated above, ordering is broken otherwise.

avatar brianteeman
brianteeman - comment - 20 Apr 2018

If you consider broken ordering as expected then I feel sorry for your users

avatar ggppdk
ggppdk - comment - 20 Apr 2018

To make a new "relevance" ordering

  • we would need to add some weighting calculation for the number of match words, because initially we were talking to keep this more basic and only check if all words were matched in the title

@alikon
Currently this PR needs a little fixing
When searching for "any" words, it only considers the last word for "priority"

I have made a PR to your branch to fix the above and also add weight calculation according to number of words matched, and then also added introtext to it beside title

(I know we said to do this only for title, but if this is made a new ordering case then it makes sense to add it)

avatar alikon
alikon - comment - 20 Apr 2018

from a quick read i would say, yes, of course, just give me some more free time to deal with this just another pandora box

avatar brianteeman
brianteeman - comment - 20 Apr 2018

If you want a weight calculation then just use finder. I just wanted to fix
a big bug not add a level of complexity

On 20 Apr 2018 8:20 pm, "Nicola Galgano" notifications@github.com wrote:

from a quick read i would say, yes, of course, just give me some more free
time to deal with this just another pandora box


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#20197 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8Sm50U8nFOKxU0UKs0_VmtWI-d8Sks5tqjUFgaJpZM4TacYk
.

avatar ggppdk
ggppdk - comment - 21 Apr 2018

@alikon (commenting @brianteeman)

If you want a weight calculation then just use finder. I just wanted to fix a big bug not add a level of complexity

If it is decided not to add weight calculation (and not a new order) and only care for the title then only remove my suggested code for introtext, the rest of PR to your branch should be valid as it fixes this

When searching for "any" words, it (this PR) only considers the last word for "priority"

avatar SharkyKZ
SharkyKZ - comment - 21 Apr 2018

If you consider broken ordering as expected then I feel sorry for your users

You seem to misunderstand the issue? The expected ordering is whatever option is selected by the user. Newest First means newest items first, Most Popular means most popular items first and so on. Ordering by relevancy is fine but forcing it on another ordering option is not.

avatar alikon
alikon - comment - 25 Apr 2018

imho we have to much option, and this obviuos search ordering don't deserve another option setting
KISS

avatar alikon
alikon - comment - 25 Apr 2018

@ggppdk replayed on your pr again KISS for now

avatar brianteeman
brianteeman - comment - 25 Apr 2018

imho we have to much option, and this obviuos search ordering don't deserve another option setting

its fixing a bug not adding a feature. we dont add options to enable bugs ;)

avatar alikon
alikon - comment - 25 Apr 2018

its fixing a bug ? ..... so it's a new feature ? #marketing

avatar alikon
alikon - comment - 25 Apr 2018

thanks to @ggppdk the last reportedd bug should be fixed now
ping @infograf768 and others please re-test

avatar brianteeman
brianteeman - comment - 25 Apr 2018

I have tested this item ? unsuccessfully on 86bd9a1

note ('%\_content%'

  CASE WHEN LOWER(a.title) LIKE LOWER('%\_content%') THEN 5 ELSE 0 END  AS relevance,a.title AS title, a.metadesc, a.metakey, a.created AS created, a.language, a.catid,CONCAT(a.introtext,a.fulltext) AS text,c.title AS section,  
  CASE WHEN CHAR_LENGTH(a.alias) != 0 THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, 
  CASE WHEN CHAR_LENGTH(c.alias) != 0 THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, '2' AS browsernav

  FROM axbz5_content AS a

  INNER JOIN axbz5_categories AS c 
  ON c.id=a.catid

  WHERE ((LOWER(a.title) LIKE LOWER('%\_content%') OR LOWER(a.introtext) LIKE LOWER('%\_content%') OR LOWER(a.fulltext) LIKE LOWER('%\_content%') OR LOWER(a.metakey) LIKE LOWER('%\_content%') OR LOWER(a.metadesc) LIKE LOWER('%\_content%'))) 
  AND a.state=1 
  AND c.published = 1 
  AND a.access IN (1,1) 
  AND c.access IN (1,1)
  AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2018-04-25 18:44:27') 
  AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2018-04-25 18:44:27')

  GROUP BY a.id, a.title, a.metadesc, a.metakey, a.created, a.language, a.catid, a.introtext, a.fulltext, c.title, a.alias, c.alias, c.id

  ORDER BY  relevance DESC,  
  LIMIT 50```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/20197">issues.joomla.org/tracker/joomla-cms/20197</a>.</sub>
avatar brianteeman brianteeman - test_item - 25 Apr 2018 - Tested unsuccessfully
avatar ggppdk
ggppdk - comment - 25 Apr 2018

@brianteeman
You were too fast, i missed proper concatenation on order clause, @alikon please merge PR

avatar alikon
alikon - comment - 25 Apr 2018

@brianteeman you are too fast for us .... ?

avatar brianteeman
brianteeman - comment - 25 Apr 2018

I have tested this item successfully on 77352d1

all good now and live on my blog


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

avatar brianteeman brianteeman - test_item - 25 Apr 2018 - Tested successfully
avatar infograf768
infograf768 - comment - 26 Apr 2018

I have tested this item successfully on 77352d1


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

avatar infograf768 infograf768 - test_item - 26 Apr 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 26 Apr 2018

Ready to Commit after two successful tests.

avatar mbabker mbabker - change - 29 Apr 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-04-29 14:45:54
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 29 Apr 2018
avatar mbabker mbabker - merge - 29 Apr 2018
avatar brianteeman
brianteeman - comment - 29 Apr 2018

woohoo - thanks everyone

Add a Comment

Login with GitHub to post a comment