Starting Over Again: Job Search Doesn't Work Properly!
I've found quite a few threads about this topic. Many had parts of solutions, but I found mostly highly frustrated customers spread all around various threads but for the same reason.
I've done a considerable amount of work here trying to diagnose the problem and explain it in detail, so Appthemes I expect AT LEAST the same amount of effort coming from you, NOW IS THE TIME TO STEP UP AND FIX THIS MAIN THEME FUNCTION ONCE AND FOR ALL.
So after all the fixes I could make, I'm still stuck with a malfunctioning search function. Here are a few behaviors I could find:
1. Searching with state name doesn't work.
Examples:
- If searching for keyword and state name (i.e. Florida) as location, will return results for that keyword, but for EVERY LOCATIONS, even though it says results for Florida, USA. -> It should only return jobs matching the keyword in or near the state.
- Yet if I search for the same keyword but using a city in that state instead of a state name (i.e. Miami) for location, will return correct results for that keyword and location, exactly as it should.
- If searching without keyword but with state name (i.e. Florida) as location, will return NO RESULTS, even if we have jobs in that state! -> If no keyword it should return all the jobs in that state.
2. Inconsistent behavior when location not found.
You can use pretty much the same examples as above but for a location that's not found. These are all #2 problems, but with location not being found because of #1 problem (using state name).
3. When no matching job for keyword near location but other jobs out of radius matching the keyword, will return all results outside of radius.
- When searching for keyword with a valid location name (i.e. Chicago):
-> If keyword location found, returns the right results.
-> If keyword not found near location NOR ANYWHERE ELSE, returns the right result: Nothing.
-> BUT if keyword not found near location but is found somewhere else, returns results outside of radius -> Should NOT return results outside of radius, for instance in California when it says 'within 50 miles of Chicago, IL, USA'.
In order to save a few useless messages, please know that the problem happens despite:
- Using last DEV Build
- Child theme and plugins disabled
- Using my own Google API Key with Javascript Search AND Geocoding enabled
- NOT exceeding geocoding daily limits
- Region biasing: US
I have tried all of these solutions below, without success:
Based on your suggestion (Googe API Limit), the Dev Team is recommending for you to try this in the file 'includes/theme-geolocation.php' replace (about line 19):
Code:
$google_maps_json_url = 'https://maps.googleapis.com/maps/api/geocode/json';
Then add below function to 'functions.php' of child theme (dont forget to set own api key):
Code:
function childtheme_add_google_api_key( $args, $type ) {
if ( $type != 'json' ) {
return $args;
}
return $args;
}
add_filter( 'jr_geolocation_params', 'childtheme_add_google_api_key', 10, 2 );
Before so doing, please backup your database just to be safe.
We have solved the issue with the Location search not working. I'm having the developer write up how he fixed it, but in the mean time.
Here are things you need to know:
1. YOU NEED YOUR OWN API KEY. We only got this to work after we inserted our own API key.
2. THE LOCATION SEARCH IS BUGGED. The "search" actually does at least TWO separate queries - the first query finds all posts that matches RADIUS and LOCATION. The second query then filters out based on the keywords used in the "All Jobs" field. If NOTHING matches the first query (RADIUS + LOCATION), then ALL jobs matching the 2nd query (keyword) are presented, rather than "No jobs found".
Comments from my developer:
Original problem was from geocoding, the limits were exceeded and being accessed from non https.
By querying the options table: SELECT * FROM wp_options WHERE option_name LIKE '_transient_jr%' , the geocode responses are saved here and indicate any error that is returned.
I applied the updates according to the forum post Incorrect search results
And set up with own api key (make sure Geocoding API is enabled)
To clear all previous saved geocoding results I deleted the records from the db: DELETE FROM wp_options WHERE option_name LIKE '_transient_jr%'
Radius Filter:
If no hits were found from the location radius filter, results were returned from all locations – essentially ignoring the location filter.
I added this line to theme-geolocation.php (around line 680 after above modifications were made)
array_push($find_posts_in,0); //if no id’s are returned this ensures the array is not empty for when the keyword filter is applied
You must be an AppThemes customer and logged in to view this response. Join today!
Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.
You must be an AppThemes customer and logged in to view this response. Join today!
Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.