8 years ago
6
Topic

The first article A[0]=>a, B[0]=>b, C[0]=>c, A[1]=>d, B[1]=>e, C[1]=>f

Hi to all

Next time about GroupX. The following situation:

1) Content Type with A, B, C fields

2) GroupX with this content type

3) Following values of this GroupX in two articles:

    The first article A[0]=>a, B[0]=>b, C[0]=>c, A[1]=>d, B[1]=>e, C[1]=>f

    The second article A[0]=>g, B[0]=>h, C[0]=>c, A[1]=>a, B[1]=>i, C[1]=>j

I need a seach with following conditions: A[i]=a AND C[i]=c. IN ONE SUBFIELD.

I have made searches with GroupX many time but only with one value. Now I can get such condition:

((t1.groupx REGEXP "(::A\\|[0-9]+\\|groupx::)1(::/A\\|[0-9]+\\|groupx::)")) AND t1.groupx REGEXP "(::C\\|[0-9]+\\|groupx::)619(::/C\\|[0-9]+\\|groupx::)" <br>

But it means that the both Articles have these conditions, because there is not defined group number ([0-9]+). And I need only first Article which have these conditions in one group.

How can I sove this problem?

Thanks in advance.

Get a VIP membership
8 years ago
1
Level 1

Hi

Sorry but I don't the get point here. You know it's possible to make a search conditions on the subfields of a groupX and the AND operator is selected by default. 

All the trick is on the storage of the field you use in the search list. Since the subfields of a groupx have no real storage (only the storage of the whole groupx is important), you have to create fields aliases that share the same storage as the groupx. 

In your case you have to create as many aliases as subfields in the groupx

Cyril

8 years ago
0
Level 2

Hi, Cylil. Thanks for your answer.

 Of cource, I applied storages to my fields - I couldn't get conditions from my example without it. My problem is not that Search is not performed, but that conditions are separated by AND - as I inderstand it has to be somehow joined like 

(::A\\|[0-9]+\\|groupx::)1(::/A\\|[0-9]+\\|groupx::::C\\|[0-9]+\\|groupx::)619(::/C\\|[0-9]+\\|groupx::)

or something similar. I need that number of subfield have to be the same for A and C...

4229 Posts
Kadministrator
8 years ago
3
Level 1

To search in groupX you need to follow this tutorial, what was said in the past that storages in the child group are not important or that they should be set to none is not correct (could be that processing has changed over time)

http://www.seblod.com/resources/extensions/plug-ins/group-x-field

Have you tried using this plugin ?

http://www.seblod.com/store/extensions/8076

8 years ago
2
Level 2

So, I see this:

Don't put your GroupX to the search type - use one of the fields from child content type. Then click on 3 ( Match and Stage ), select desired matching and press + and choose your GroupX collection. Unfortunately this works only for 1 GroupX.

As I understood I can use search by one field only... unfortunatelly. I'm crying..

4229 Posts
Kadministrator
8 years ago
1
Level 3

It is written a bit unclear - you can indeed use only single groupX field in search (parent), but you can add as many child fields (from content type selected in GruopX) as you like to the search type - as I understand this is what you would like to do?

8 years ago
0
Level 4

Yes, I understand.. But it will be search with several conditions.. 

Ok, real example - I make a likes for article. I have a Content type with two fields: Like/Unlike (type: radio, name: Likes)  and id of Liker (type: text, name: Likerid). I put this CT to GroupX and add field to the Article. Now I need a search to find articles which was liked by user with id 613 - likes=2 AND likerid=613 IN ONE SUBFIELD

Get a Book for SEBLOD