How can I specify address in facebook place search - facebook-graph-api

If I want to find places near some address in facebook graph search search, given than I know it's street, zip, what is the syntax for the query to graph api?
If I call https://graph.facebook.com/v2.7/search?type=place I get following error:
(#100) Must specify location or address or search query for place search
I know, that it is possible to specify location in a form of latitude/longitude, but with lat/lon it does not return all places (maybe because some of them do not have lat/lon specified in location).
The error says 'location or address'. What is the syntax for specifying address in a form of street/zip? Is that possible at all?

You must specify a query string for search using q=your_search_query
Search query needs to be a string
https://graph.facebook.com/v2.7/search?type=place&q=bangalore&access_token=your_token works for me
You can specify lat/lng using center parameter
https://graph.facebook.com/v2.7/search?center=37.76,-122.427&q=coffee&type=place&access_token=your_token
Source: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.7#search

Related

How can I get all the information from an address that has multiple Places_id

I send a HTTP request, with only the address, I do not know the name of the place/company. I get a Place Id, but it does not give me any additional information. However, if I send an HTTP request with the same address, and the name of the building/company, I get another place id, at the same location, but here I get all the additional info that Places provides.
But I have to find the place only by the address. Does anyone have any suggestions on how to make this work, or how do I get the name of the building at the address out, Places does not give out a name when I only enter the address.
This is the input with the name and address, from the location
These additional infos I get to the Place ID, at name + address
This is the input with only the address, from the location
These additional infos I get to the Place ID,from only the address
The screenshot you provided shows that you have set the fields parameter to only get the name, business_status and place id. I suggest you take a look here to see the list of available data/fields that can be retrieved.
I am not entirely sure what Places SKU/requests you are making, but removing the fields parameter will allow you to retrieve all the data. Do note that you will be billed accordingly for Contact and Atmosphere Data. Basic Data is free of charge.
Lastly, place ids are unique, and each address can only have one. You may want to make use of Place Autocomplete to see a list of suggested addresses and check which one you are looking for. After which, you can pass its place id to a Place Details request to get information on that place.

Drupal 8: Altering Search API queries

I'm working on a project which includes the following activated modules:
Drupal core 8.2.3
Database Search 8.x-1.0-beta4
Search API 8.x-1.0-beta4
Search API Term Handlers 8.x-1.0-beta4
Views 8.2.3
I have a list of nids which need to be excluded from the search result of the site-wide search. The search uses Search API and has been setup using Views.
The table in the database is: "search_api_db_default_index"
The field I wish to target is: "nid"
I wasn't able to get HOOK__search_api_query_alter or HOOK_search_api_results_alter to fire, so I am attempting to manipulate the query through HOOK_views_query_alter.
I have attempted to use both the "addWhere" and "addCondition" methods with the following syntax:
When using the addCondition method, I attempted
$query->addCondition('search_api_db_default_index.nid', $oneBadNid, '<>');
and
$query->addCondition('search_api_db_default_index.nid', $manyBadNids, 'NOT IN');
and when using the addWhere method, I attempted
$query->addWhere('AND', 'search_api_index_default_index.nid', $oneBadNid, '<>');
and
$query->addWhere('AND', 'search_api_index_default_index.nid', $manyBadNids, 'NOT IN');
Regardless of whether or not I prefix the field with the table name, searching always results in triggering the following notice:
Unknown field in filter clause: 'search_api_db_default_index.nid' .
It seems that the field name is always wrapped in an html encoded string representing a single quotation, but this occurs both when using double quotations or single quotations around the supplied table.field parameter.
I am not even sure that this is what is keeping me from altering my query, but it is the only thing close to an error which I have discovered in this process. It's also possible that I'm simply not supposed to be targeting the table in the manner written, but I did not find any documentation directing me to the proper methodology.
I would appreciate any insight into this issue! Thanks!
Generally you can use
$fields = $query->getIndex()->getFields();
on the query to get an array of fields you can use within the search_api query.
Piggy-backing off of Nebel54's comment, and attempting this on my own, you don't need to include the 'table' name when setting the addCondition. However, I did need to use hook_search_api_query_alter over a views-specific one.
function mymodule_search_api_query_alter(\Drupal\search_api\Query\QueryInterface &$query) {
// Ensure field_myfield is being indexed
$fields = $query->getIndex()->getFields();
if (isset($fields['field_myfield'])) {
$query->addCondition('field_myfield', 'myvalue', '<>');
}
}

wso2 das query using a mac address returns incorrect set

I have a simple event stream that is persisted with the following attributes:
message, type string
timestamp, type string
host, type string
mac_address, type string
where the mac_address and host are index columns.
When I query the table in the Data Explorer with mac_address:00-24-AC-7B-58-01, I get all records no matter what the mac address is. If I change the query to mac_address:01, I get only the records with a mac address ending in 01. I assume the the "-" in the mac address is being interpreted in a special way. I have tried to to put quotes around the mac address, but that does not make any difference. Does anyone know why this is happening? Is there a way to work around it?
I was able to get the query to work using the following:
_mac_address:"00-23-AB-7B-58-01"
Pre-pending the underscore to the field name apparently tells the search to do an exact match. I found this at:
docs.wso2.com/display/DAS301/Query+Language+Reference
on the bottom of the page.
But, I still cannot seem to get a query to search on an IP address successfully no matter what I try. Maybe the period in the search string is throwing the search off.
As a side note, I found a way to search for the mac address using the restful API, by escaping the quotes as follows:
{ "tableName":"MYTESTIN1", "query":"mac_address:\"00-23-AB-7B-58-01\"", "start":0, "count":100 }

Regex for Google analytics advanced segment based on custom variable value

Trying to create an advanced segment (include) using regex (or any other filter mechnanism, contains with just the substring isn't working either) which uses the value of the custom variable value.
It ought to be straightforward, but it's driving me insane. I currently have this regex:
.*CLAS_LIBRARIES.*
which rightly matches a custom variable value of:
HOME/CLASMAIN/CLAS_LIBRARIES/
but when I apply the segment and then browse the custom variable values in the report, it contains values like:
HOME/
/museumcollections/
HOME/MAPS/
Tried wrapping it like this:
.*(CLAS_LIBRARIES).*
(.*)(CLAS_LIBRARIES)(.*)
to no avail.
What the hell is going on, and am I an idiot?
What's the scope of your custom variable? Can multiple sessions have different values?
Advanced segments will return any data that matches your query (e.g. in case of creating a segment for a specific page, GA will return data for all user activity which included that specific page as part of their navigation).

Get current Location Value under Regional language setting in c++

Want to extract country name from the control panel->region and language->location current location value
i have tried following function of win32
GetLocaleInfo(returns culture)
GetSystemDefaultLCID (returns language).
Also looked at the GetGeoInfo
but not able to extract the country name.
I hope i am clear with my question
Its available by:
Get a GEOID by calling GetUserGeoID() with GEOCLASS_NATION
Pass the GEOID to GetGeoInfo() along with GEO_FRIENDLYNAME to fetch the string in the language specified in LangId (GetUserDefaultLCID() for the current)