Skip Navigation

[Resolved] Search OR condition

This support ticket is created 7 years, 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 52 replies, has 4 voices.

Last updated by Akhil 7 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#515669

Dear Sgc,

As your request, I have taken this thread, and I am checking it in your website, will feedback if there is anything found.

#515675

Thank You Luo.
Do let me know if you need more information.

#515716
search-or-condition.JPG

I can login your website, here is what I found, please correct me if there is anything missing, I assume we are talking about the problem page:
hidden link
and the wordpress archive:
hidden link

in above wordperss archive, section "Query Filter", I do see it is using OR logic, see screenshot: search-or-condition.JPG

Is this problem resovled? If it is not problem view or page, please point out the problem page URL and view URL, where should I check, you can simply use ''your-domain-name" to replace your domain name. and I have enabled the private detail box, thanks

#515721

Pls look at the prompt too " Your custom field filters are using an internal "OR" kind of relationship, and dependant custom search for those filters needs "AND" relationships. after repair it goes back to AND.

#515724
Screen Shot 2017-04-21 at 5.51.25 pm.png

Hi Luo , . i've attached my filters that generated .

#515727

You could try general search, check both For Sale and For Rent . there is no result , But if you select individual there is result. This is the issue. thanks

#515731

Yes, I can see the warning message, as it mentioned:
The dependant custom search for those filters needs "AND" relationships
It will conduct some unexpected problem.
You will need to disable the dependant parametric search(ajax parameter search form)
you can simply try this:
edit the problem wordpress archive:
hidden link
in section "Custom Search Settings", enable the option "Full page refresh when visitors click on the search button", and test again.

#515736
Screen Shot 2017-04-21 at 6.27.32 pm.png

HI thanks. I just tested it still not solving.

Pics attached. Pls feel free to test and let me know. thank you.

#515750

There are two filters in the wordpress archive "Landed House Archive":
Select items with field:
Landed House Type is a string equal to URL_PARAM(landed-house-type)
AND
Property Type is a string equal to URL_PARAM(property-type)

The comparison is using "equal to", that means it should be absolutely same as the URL parameters, but you are using checkboxes field in the custom search form, in this case I suggest you change the comparison to "in", for example:

Landed House Type is a string in URL_PARAM(landed-house-type)
AND
Property Type is a string in URL_PARAM(property-type)

More help:
https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
compare (string) - Operator to test. Possible values are '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS' and 'NOT EXISTS'. Default value is '='.

Please test again, check if the problem is fixed or not.
And if the original question of this thread has been resolved, please create new thread for the new questions. this will help other users to find the answers. thanks

#515755

Thanks Luo. This sound very logical to me . I'll check n revert soon.. Many thanks again.

#515809

HI Luo. i checked after made the changes as you suggested some fields might need adjustment and your advice.

Pls test this scenario and you will see the issue.

District 3 has 1 results.
Distict 28 has 3 results.
if were to choose both D3 or D28 we have no results.

I got a strong feeling that my search form need a mixture of AND and OR. In which there is no such option .

Please look into this please . Thanks.

#516357

Q1) D3 or D28 we have no results.
It is a new question, please create new thread for the new questions, that will help other users to find the answers.
And I have tried to login in your website, but the reCAPTCHA is wrong, please check it

Q2) search form need a mixture of AND and OR
You can setup only one "relation" parameter in a wordpress query, you can not setup mixture of AND and OR in a view.

This is not possible within Views, Views plugin is using wordpress class WP_Query to query the post:
https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
relation (string) - The logical relationship between each inner meta_query array when there is more than one. Possible values are 'AND', 'OR'. Do not use with a single inner meta_query array.

#516359

Hi Luo,

1. its still within the same subject, i'm giving you some sample to test . i hope you understand this. Ill De-activate the captcha now.

2. OK. i understand this but im sure there is some workaround for this other then using this method ? Pls suggest anything you can think of.

many thanks.

#516391

Hi LUo

Ive De-activated solve the captcha issue .moving forward ,
do you have any suggestion for me now ?

#516396

68926022 aplogies there is two factor activated, removed now. thanks