algolia / algoliasearch-client-objc Goto Github PK
View Code? Open in Web Editor NEWAlgolia Search API Client for iOS & OS X
License: Other
Algolia Search API Client for iOS & OS X
License: Other
Do you guys have an eta for a swift library? or a tutorial for using the Objective c via a bridging header?
Hi,
I was trying to a disjunctive search using objective c API, when i searched through the api documentation, i found this
Query* query = [[Query alloc] initWithQuery:@"luxury"];
query.facets = @[@"facilities", @"stars"];
NSDictionary* refinements = @{
@"facilities": @[@"wifi"],
@"stars": @[@"4", @"5"]
};
[index searchDisjunctiveFaceting:query disjunctiveFacets:@[@"stars"] refinements:refinements completionHandler:^(NSDictionary* content, NSError* error) {
// [...]
}];
but when i try writing the code the function searchDisjunctiveFaceting doesn't appear.
When hitting a 400
error, the errorMessage
doens't include the actual API error: { "message": "......" }
While I am working on advance search i am trying to use disjunctive faceting but not getting any idea how to implement it in objective c, as because I want to send multiple facet filtering data with “AND” and “OR” value together for algolia client search. Is it possible to do. Can you please tell me how.
This issue aims to open the discussion about AFNetworking 3.0.
Brief: Currently, we use AFHTTPRequestOperationManager to manage the request. This class was removed in AFNetworking 3.0. Instead, we should use the another class (AFHTTPSessionManager) which is already available in AFNetworking 2.0. This class use the new API of Apple: NSURLSession (available since iOS 7.0) instead of NSURLConnection.
Pros: Well, AFNetworking 3.0 officially supports iOS 7+, Mac OS X 10.9+, watchOS 2+, tvOS 9. Currently, our version of AFNetworking doesn't support tvOS :(
Cons:
The parameter useQueryEqualsOneAttributeInRanking
can not be set in the Query
Commit 73a3c7f allow the user to change the applicationID after the initialisation of ASAPClient. I think this is not a good idea, because in this case the header are changed but not the generated hostname.
And we can't auto-generate the new hostname. Indeed, the user has maybe the DSN option or uses only one host.
The ASQuery aroundLatLong used ti be public so when I wanted to query an index with
searchAroundLatitude method first and then requery it without location I used to set query.aroundLatLong to nil and that worked like a charm.
What is the recommended way now?
For sure I can build two queries but it's a bit sad...
Add a way to specify query parameters by name and string value. This is intended as an untyped, low-level accessors to bypass limitations of the Query
class (e.g. unsupported parameters).
Note: this is a backport of a feature already implemented in the upcoming v3 of the Swift client.
Remark: Solving this issue would automatically fix #23 and #24.
The parameter minimumAroundRadius
can not be set in the Query
Hello guys,
our application just noticed crash in algolia search library and I was fortunate enough to have debugger plugged in, so I am sending the report to you.
Crash occured while basic query to one of the indexes we have in Algolia. We received 400 response (can't really tell why, never happened to us before) - then the crash occured:
ASAPIClient+Network.m
AFHTTPRequestOperation *operation = [httpRequestOperationManager HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id JSON) {
if ((operation.response.statusCode / 100) == 2) {
success(JSON);
} else {
failure(@"No error message");
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if ((operation.response.statusCode / 100) == 4) {
NSData *errorData = error.userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey];
// Here, the crash occured, because errorData == nil
NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData: errorData options:kNilOptions error:nil];
failure([NSString stringWithFormat:@"Bad request argument: %@", JSON[@"message"]]);
} else {
if ((index + 1) < [managers count]) {
[self performHTTPQuery:path method:method body:body managers:managers index:(index + 1) timeout:(timeout + 10) success:success failure:failure];
} else {
failure(error.description);
}
}
}];
When I went through the variables in debugger, here is what I got:
(lldb) po error
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Unescaped control character around character 53.) UserInfo=0x171460d80 {NSDebugDescription=Unescaped control character around character 53., NSUnderlyingError=0x17024cea0 "Request failed: bad request (400)"}
(lldb) po operation
<AFHTTPRequestOperation: 0x1741cd890, state: isFinished, cancelled: NO request: <NSMutableURLRequest: 0x17420c160> { URL: https://AKEWZBYMIT-dsn.algolia.net/1/indexes/[OURINDEX]/query }, response: <NSHTTPURLResponse: 0x170824dc0> { URL: https://akewzbymit-dsn.algolia.net/1/indexes/[OURINDEX]/query } { status code: 400, headers {
"Access-Control-Allow-Credentials" = false;
"Access-Control-Allow-Headers" = "x-algolia-application-id, connection, origin, x-algolia-api-key, content-type, content-length, x-algolia-signature, x-algolia-usertoken, x-algolia-tagfilters, DNT, X-Mx-ReqToken, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Authorization, Accept";
"Access-Control-Allow-Methods" = "GET, PUT, DELETE, POST, OPTIONS";
"Access-Control-Allow-Origin" = "*";
Connection = "keep-alive";
"Content-Length" = 91;
"Content-Type" = "application/json; charset=UTF-8";
Date = "Wed, 29 Apr 2015 11:41:13 GMT";
Server = nginx;
} }>
The bug is pretty obvious, AFNetworking did not provide their underlaying error so it crashed. I suspect it will be very rare, but it still should be conditioned in case it happens to somebody else.
Have a nice day and keep up good work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.