Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › AND, OR search operators
This topic contains 12 replies, has 2 voices, and was last updated by gintautas 9 years, 11 months ago.
- AuthorPosts
- October 4, 2014 at 11:20 pm #2583
Hi, how to set research logic operator by default? Now when I search in titles I get results with operator “OR”. When i type two words i need to get results with “AND” operator. In this case as shown in picture there should be no results. Thank you.
October 4, 2014 at 11:20 pm #2584Hi, how to set research logic operator by default? Now when I search in titles I get results with operator “OR”. When i type two words i need to get results with “AND” operator. In this case as shown in picture there should be no results. Thank you.
Attachments:
You must be logged in to view attached files.October 6, 2014 at 6:13 pm #2594Hi!
Currently the search work only with an OR operator for separate keywords. However the 3.2 version is almost deployed to codecanyon, which contains this feature. I’m attaching a pre-release version here for you, so you can try this feature now.
Steps for upgrade
0. Make a backup copy of the current search folder just in case. It’s located in wp-content/plugins/ajax-search-pro/
1. Deactivate, delete the old version through the plugin editor
2. Install the one I attached here
3. Open up the search setting and save them to refresh the database values and to re-create the stylesheetsOn the General option->Behaviour tab you should see now a new option dropdown called “Keyword Logic” where you can choose from ‘OR’ and ‘AND’.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 6, 2014 at 9:51 pm #2602Hi! Thank you a lot. I did all what you wrote and played a lot, but AND option in behaviour settings doesn’t work in searches for Buddypress groups (titles) and other content types. Are you sure that new function is really working?
Kind regards,
GintasOctober 6, 2014 at 9:59 pm #2603I didn’t know you are searching buddypress content. It’s not yet implemented there. It’s most likely getting done tomorrow. I will post a message here if we have a prototype to try.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 6, 2014 at 11:12 pm #2604Thank you. I attached a screenshot of Relevanssi search plugin. Here is quite good idea when you choose AND operator as default and the search finds no matches, it will automatically do an OR search. Google does the same and shows under every result Missing: <striked out search term>. I use this plugin for search in groups titles. All these titles are addresses of buildings, so it’s important to get houses in results with exact street name and number. Now i get results from different streets with same number. Will be waiting for an update and thank you.
Kind regards,
GintasOctober 6, 2014 at 11:47 pm #2605Attachment:
October 7, 2014 at 3:51 pm #2617Hi!
I just finished an update, which contains the improvements for the buddypress search as well. On top of that there are 4 options now: ‘OR’, ‘AND’, ‘OR – exact words’, ‘AND – exact words’. This is a huge step forward and it’s not yet properly tested. The update instructions are the same as before.
On top of that there are options now to enable/disable the search in public, private and hidden buddypress groups.Try out the ‘AND’ or the ‘AND – exact words’ option on the General option->Behaviour tab, one of them will suit your needs for sure.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 7, 2014 at 5:37 pm #2623Hi!
Thank you! Now looks better and more useful. But there is one thing. In previous versions when i typed any word having latin only characters i used to get results with non-latin characters too. I.e. if i typed “mazvydo” i got results with group title “Mažvydo” (letter “z” is with bird) In my language there are such symbols: ąčęėįšųūž. And many people types these letters in latin, but group names has these non latin letters except slugs. Can you solve this? Maybe 3.1 version searched in group titles and in url’s?
Here you can download a video (better resolution) to see this problem: https://www.dropbox.com/s/xvqh17fnva3phla/nonlatin.mov?dl=0Also in behavior settings could be an optional box to thick: “If you choose AND and the search finds no matches, it will automatically do an OR search.”
Kind regards,
GintasOctober 7, 2014 at 6:01 pm #2624You are correct, that’s a problem. Fortunately it was only a typing mistake in the code. You only need to replace one file now to fix this. Go to wp-content/plugins/ajax-search-pro/includes/search_buddypress.class.php and open that file.
Replace the file contents with this: http://pastebin.com/raw.php?i=aT97MJvP
It should fix the issue immediately.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 7, 2014 at 6:19 pm #2625After replacing search_buddypress.class.php plugin doesn’t give any results at all… Any ideas?
October 7, 2014 at 6:29 pm #2626Try this one: http://pastebin.com/raw.php?i=Wt37DnL0
The problem is that this way the database cannot distinguish the whole words from partial words. This will work, but will recognize partial words as well. I think you won’t even notice the difference, there is very little from the previous one.
I was reading throuhg the documentation all day, but unfortunately, with mysql database there is no solution to exact word matches and to match special characters with no special characters at the same time 🙁
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 7, 2014 at 6:53 pm #2627Now it works 🙂 Thank you!
- AuthorPosts
You must be logged in to reply to this topic.