9 years ago
Topic

Hello,

I'm using a field from type "Textarea" called "About the lecture"". In this field users (lecturers) are asked to provide details about their lectures (in their profiles).

In my site I want to allow all visitors (mostly these are managers of companies who are interested in lectures) to search for profiles using keywords and words such as: "humor lecture", "body language show", "lecture about health" etc.

How do I create a new field that will search within the field of "About the lecture" ? I want the new field to be a simple line of text that will be used for that kind of search.

Since I'm not a Seblod expert I hope you could please provide a full explaination :)

Many thanks,

Ofer.

Get a Book for SEBLOD
4229 Posts
Kadministrator
9 years ago
3
Level 1

Hi,

you need to create new search type and place your textarea field in the search tab. You could also replace it with smaller text box and set this new fields storage to the same setting as it is set to in textarea field.

9 years ago
2
Level 2

Hi Klas,

I appreciate your answer.

Since in the search page on my site I'm already using a Search Type called "Search" I tried to follow your guidelines by adding a new field (called "Free Search") that these are its details:

Type: textarea

Rows: 1,

Columns: 25,

Storage (I used the exact storage info like the original field that I want to search whithin): Standard - Article - servicedescription.

I didn't mark anything in Alter field.

Results: In my search page on my site, this field didn't work when I searched for keywords that exist like: "humor" (when searching for a lecture about humor). More over, the text area spread on 5 row instaed of 1 row.

I hope you could help me.

Many thanks,

Ofer.

4229 Posts
Kadministrator
9 years ago
1
Level 3

You also need to set the right matching (button 3 on the right), for your case it should be Permissive or Any words (if you with to search for articles that contain any of the words user searches for, not exact phrase). Instead of using textare I would recommend that you use Text as textarea is usually too big for searches.

9 years ago
0
Level 4

Thanks. I changed it to text and it looks much better, but it doesn't do search. Meaning that when choosing Permissive or Any word doesn't give any result. I'm almost sure that I did somthing wrong in the Storge section.

What might it be?

Thank you very much.

4229 Posts
Kadministrator
9 years ago
4
Level 1

Hi,
Yes, you're certainly right about the storage. At first always enable the debug mode on your search type if you find some issue and copy paste the SQL query displayed in your forum post.


To create what we call an "alias" of another field you must create this field by using the field manager (this field must not be linked to a content type but must be an independant field). To check this be sure after created your field that there is no message displays near the "storage" of your field such as "linked to a content type". 

Please post a screenshot of your alias field configuration.

9 years ago
3
Level 2

Thanks Klas.

I have a few questions:

1. How do I enable the debug option?

2. How do I get to the Field Manager? 

3. How do I create an alias field? What are the steps?

Thank you very much for your help.

Ofer :)

4229 Posts
Kadministrator
9 years ago
0
Level 3

Hi,

1. this is done in your search type configuration tab

2. field manager is in the left menu when you are in seblod component (Fields), you can find it also in Construction admin menu.

3. Alias field is a field using exactly the same storage as your original field, this way you can e.g. use a different type field in search than it is used in form

175 Posts
webcastor
9 years ago
1
Level 3





9 years ago
0
Level 4

Thank you webcastor and Klas.

This is the SQL query that I get:

TextSELECT 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_item_content` 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-10 05:13:34' ) AND ( t2.publish_down = '0000-00-00 00:00:00' OR t2.publish_down >= '2014-09-10 05:13:34' ) AND t0.cck = 'profilenew' AND t1.servicedescription LIKE '%הרצאות%' GROUP BY t0.pk ORDER BY t2.title ASC 0.010 seconds (0.010); 9.87 MB (9.871) - afterSearch [Cache=OFF] = 0 result. 0.010 seconds (0.000); 9.87 MB (0.002) - afterRender


And you can also see how it looks like in the image attached.

My purpose all along was to create a line of text that will allow visitors to search within the database. What I tried to do here is to create an alias field that will search withing another field's data.

This is the ORIGINAL field:

This is the ALIAS field (that searches withing the original):

(am I uploading the images correct?)

Thank you very much,

Ofer.

4229 Posts
Kadministrator
9 years ago
5
Level 1

Hi,

i might be my advice was a bit wrong - try deleting alias field and recreate it within your search type with padlock closed, I think what is happening is that field is searching within wrong table as when padlock is closed table is #__cck_store_form_CONTENTTYPENAME while if it is open like in your alias fields case table is #__cck_store_item_CONTENTTYPENAME - as you can see in your query it is looking at second one (see first join) while it probably should be looking at first.

9 years ago
4
Level 2

Great :) 

I just didn't understand how do create a field with a closed padlock in my "Search" (Search Type)?

Many thanks,

Ofer.

4229 Posts
Kadministrator
9 years ago
3
Level 3

Sorry, I missed there is no padlock in search - you need to go to your form and create new field there while having padlock closed (small paddlock on the top right side of the fields list). As new field is auto added to the content type you will need to remove it, then go to the search type and add it from the list of fields.

9 years ago
2
Level 4

Will the new field have to use the same storage as the original field (whom i want to search within)?

Thanks :)

175 Posts
webcastor
9 years ago
1
Level 5

Of course it will have to use the same storage as the original field. The fields in SEBLOD are visual representation (on screen) of the data located in storage (database table columns), while containing the logic necessary to make it all work. Many fields can be bound (correspond to) a single table column. Even more so if you use Custom storage, when values are technically treated as different (based on attribute), but that is not the case in this matter.

However, it's important to remember the context, which in this case is Content Type. Since in your case your "context" is exclusive to content type, it have to be searched (referenced) as such.

9 years ago
0
Level 6

1. I've created a new field inside Form & Content (with padlock closed) + Using the storage of the origianl Fields (the one that I search within)

2. I added that field to my List % Search Type

3, On level 3 I chose "Any words"

4. Custom Attributes >> style="width:221px !important"

Works like a charm :)

By the way, is there any way to what people are searching for (in this new field) in Google analytics or in any other way ?

Thank you webcastor and Klas :)

Get a Book for SEBLOD