10 years ago
1
Topic

Hello

Groupx are great for creation, much less for search !

Let's have a  groupX with groupx_field1 and groupx_field2

Now we call the groupx into myContent with the field mycontent_groupx

HOW can we perform a search on the myContent type filtered on values of groupx_field1 or groupx_field2 ?

I know this is a common request. We found JS solutions we don't like. We also know we can get rid of the groupx and work with separated content types with Joint searches but we like the +/- feature of the groupx. 

Here is what I did:

1- I create a groupx

2- I create a content type 'myContent' that includes the groupx 

3- I create some contents (with values for the groupx)

4- I make a seblod list&search on the main content type (myContent: the one that includes the groupx)

5-in the search tab of this search I set one field groupx_field1 of the groupx

6- in the search tab , in the (3) button on the groupx_field1 I set the collection to the groupx name 

When I performed a search, specifying one value for the groupx_field1, the search finds nothing SINCE it tries to find something in the groupx table (cck_store_form_groupx) but this table is EMPTY (because the datas are stored in the introtext of the myContent articles)

the SQL search performed is:

SELECT t0.id as pid, t0.pk as pk, t0.pkb as pkb,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 `#__cck_store_form_groupx` AS t1 ON t1.id = t0.pk
LEFT JOIN `#__content` AS t2 ON t2.id = t0.pk
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 <= '2014-09-18 08:29:39' ) AND ( t2.publish_down = '0000-00-00 00:00:00' OR t2.publish_down >= '2014-09-18 08:29:39' ) AND t0.cck = 'client' AND t1.groupx_field1 LIKE '%00%' GROUP BY t0.pk
ORDER BY t2.title ASC

Again the t1 table is empty since the groupx_field1 data is stored in the introtext of the main content type!

What is your solution then please ?

thanks

cyril

Get a Book for SEBLOD
10 years ago
0
Level 1

Ok with the help of Bes and Jeremie I found what I forgot:

you have to specify the storage location of the groupx_field as custom/article/introtext !!!

It is not important for the storage itself since all the groupx fields are stored in the introtext (actually as the groupx storage location definition) BUT in the search form we need to force seblod to perform the regex into the introtext of the main content

Thanks

cyril

Get a Book for SEBLOD