Skip Navigation

[Resolved] I have created a search view but it search only case sensitive.

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 2 voices.

Last updated by Minesh 2 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2412229
34a89410-5c05-4ab3-bb47-2965401e2e35.png

Hey There!

I have created a search view but it search only case sensitive.

I have also tried like operator but it didn't work.

You can check it on below link. When you search "Fireplace" it will search but when you will search "fireplace" it is showing No items found.

hidden link

Thank you.

#2412253

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems you setup a text search on custom field. Can you please share screenshot of "Query Filter" section of of your view?

Or you can share admin access details so I can check whats going wrong with your setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2412997

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing admin access details.

I checked and I found that the text search filter you added is for the checkboxes field type. Checkboxes fields are special fields and the value of the checkboxes fields are stored as serialized array within the database. It's not advisable to build text search on the checkboxes fields.

There are two options, either you should change the field type to another field type but then you will not have multiple choices like checkboxes offers. I would recommend that you should create a additional field that should hold the values for selected checkboxes options and then use that custom field for search. You can use the save_post action so when post is published or updated (saved) you should copy the selected checkboxes options to the newly single line custom field you created.

More info:
=> https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/

I hope this makes sense. Please let me know your feedback on this.

#2413067

Hi Minesh,

Please check this loom video link below and help me regarding this issue.

hidden link

I do as you say but still got the issue. Please check it.

Thank you.

#2413795

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So, I've moved the "save_post" hook code to "Custom Code" section offered by Toolset as well as I've adjusted the code as given under:
=> hidden link

function is_plan_features( $post_id, $post ){
    if ( 'plan' == $post->post_type ) {
        //$plan_features = get_post_meta( $post_id, 'wpcf-plan-features', true );
        $plan_features = types_render_field("plan-features",array('item'=> $post_id));
      
      	
        if ( !empty($plan_features) ) {
            update_post_meta( $post_id, 'wpcf-store-plan-features-values',$plan_features);
        }
    }
}
add_action( 'save_post', 'is_plan_features', 101, 2 );

Then, I edit the following post: hidden link
And clicked on Update button and I see when I update the post it copy the selected checkboxes option values from field "Plan Features" to newly created field "Store Plan Features Values". Screenshot: hidden link

Note:
You will have to update every post you have for post type "plan" so that the selected checkboxes option values will be copy to the newly created field "Store Plan Features Values".

With the following view, I've added the query filter for the newly created field "Store Plan Features Values" that actually displays the view's output:
=> hidden link

Store Plan Features Values is a string like URL_PARAM(wpv-wpcf-store-plan-features-values)

Then I tried to search and I can see as currently, I've updated one post which has the values stored within the field "Store Plan Features Values".
- hidden link

When I search with keyword "fireplace", I can see the "Rivendell" post in result for which the "Store Plan Features Values" field has values.
=> hidden link

You should update all posts and it should work normal.

#2413861

Thanks. That's resolved my issue. 🙂

#2413863

My issue is resolved now. Thank you!

#2413865

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to help. You can mark resolve this ticket 🙂

#2413869

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ahh, it seems we cross-posted. You can mark resolve this ticket with different message like "This issue resolved now".