7 years ago
6
Topic

Hi

We know Klas submit this workaround https://www.seblod.com/resources/tutorials/workaround-for-search-by-tag-issues but with the latest Joomla / SEBLOD releases (3.6.3 + 3.9.1) we can just put the ARTICLE TAGS field in the search form and it works


The search criterion on the article tags field is ANY WORD EXACT

However the trouble is when we want to search contents that have several tags (in my example the tags ids are 2 and 6)  the query is 

SELECT t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.cck AS cck,t0.storage_location AS loc,tt.id AS SELECT t0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.cck AS cck,t0.storage_location AS loc,tt.id AS type_id,tt.alias AS type_alias 

FROM `#__cck_core` AS t0
LEFT JOIN `#__content` AS t2 ON t2.id = t0.pk
LEFT JOIN `#__contentitem_tag_map` AS t1 ON (t1.content_item_id = t2.id
AND t1.type_alias = "com_content.article")
LEFT JOIN `#__cck_core_types` AS tt ON tt.name = t0.cck
WHERE t2.state = 1
AND t2.access IN (1,1,5)
AND ( t2.publish_up = '0000-00-00 00:00:00' OR t2.publish_up <= '2016-09-29 15:08' )
AND ( t2.publish_down = '0000-00-00 00:00:00' OR t2.publish_down >= '2016-09-29 15:08' )
AND t0.cck = 'profil'
AND t1.tag_id IN ('2,6')
GROUP BY t0.id
ORDER BY t2.title ASC
LIMIT 25

but the line : AND t1.tag_id IN ('2,6') is not what we want. The way the tags mapping is stored in the database prevents us from selecting contents that have both tags

 

What is the solution please ?

thanks

cyril

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
0
Level 1

That tutorial is outdated, I unpublished it.

t1.tag_id IN ('2,6') should match any of this tags or both. If you wish to see only articles with both tags you need to use "each word exact".

7 years ago
1
Level 1

Hello Klas

I knew you would answer this but I had to start with this example to follow your tutorial.

Of course we also tested with EACH WORD EXACT but the request now is:

AND ((t1.tag_id = '2,6' OR t1.tag_id LIKE '2,6 %' OR t1.tag_id LIKE '% 2,6 %' OR t1.tag_id LIKE '% 2,6'))

Which doesn't work at all since there is always ONE id stored in the #__contentitem_tag_map table, there is NEVER X,Y

Hence my question

Thanks 

Cyril

7 years ago
0
Level 2

The new 3.10 seblod doesn't solve this issue unless there is a setting I don''t know. I really don't see how we can search contents that have several tags with the J Tag field in the seach form

thanks

cyril

7 years ago
2
Level 1

Hi

We developped then a new plugin to allow the search of contents according several tags. Feel free to download it and use it on http://www.pulsar-informatique.com/telechargements-gratuits/search-tags

thanks

cyril

548 Posts
joomleb
7 years ago
1
Level 2

Hi Cyril, 

many thanks for your work ! Please, How to contact you ?

7 years ago
0
Level 3

HI Thanks!

please use the contact form on http://www.pulsar-informatique.com/ 

Get a VIP membership