Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
com.algolia:algoliasearch-offline-android
Advanced tools
This Android library lets you easily use the Algolia Search API from your Android Application, with additional offline capabilities. It wraps the Algolia Search REST API and the Algolia Search Offline Core.
Algolia Search is a hosted search engine capable of delivering realtime results from the first keystroke.
The Algolia Search API Client for Android lets you easily use the Algolia Search REST API from your Android code.
Note: If you were using version 2.x of our Android client, read the migration guide to version 3.x.
You can browse the automatically generated reference documentation.
This project is open-source under the MIT License.
Your contributions are welcome! Please use our formatting configuration to keep the coding style consistent.
You can find the full reference on Algolia's website.
Install the Android client by adding the following dependency to your Gradle
build file:
dependencies {
// [...]
implementation 'com.algolia:algoliasearch-android:3.+'
// This will automatically update to the latest v3 release when you build your project
}
In 30 seconds, this quick start tutorial will show you how to index and search objects.
To start, you need to initialize the client. To do this, you need your Application ID and API Key. You can find both on your Algolia account.
Client client = new Client("YourApplicationID", "YourAPIKey");
Index index = client.getIndex("your_index_name");
Warning: If you are building a native app on mobile, make sure not to include the search API key directly in the source code. You should instead consider fetching the key from your servers during the app's startup.
Without any prior configuration, you can start indexing contacts in the contacts
index using the following code:
Index index = client.initIndex("contacts");
index.addObjectAsync(new JSONObject()
.put("firstname", "Jimmie")
.put("lastname", "Barninger")
.put("followers", 93)
.put("company", "California Paint"), null);
index.addObjectAsync(new JSONObject()
.put("firstname", "Warren")
.put("lastname", "Speach")
.put("followers", 42)
.put("company", "Norwalk Crmc"), null);
You can customize settings to fine tune the search behavior. For example, you can add a custom ranking by number of followers to further enhance the built-in relevance:
JSONObject settings = new JSONObject().append("customRanking", "desc(followers)");
index.setSettingsAsync(settings, null);
You can also configure the list of attributes you want to index by order of importance (most important first).
Note: Algolia is designed to suggest results as you type, which means you'll generally search by prefix. In this case, the order of attributes is crucial to decide which hit is the best.
JSONObject settings = new JSONObject()
.put("searchableAttributes", "lastname")
.put("searchableAttributes", "firstname")
.put("searchableAttributes", "company");
index.setSettingsAsync(settings, null);
You can now search for contacts by firstname
, lastname
, company
, etc. (even with typos):
CompletionHandler completionHandler = new CompletionHandler() {
@Override
public void requestCompleted(JSONObject content, AlgoliaException error) {
// [...]
}
};
// Search for a first name
index.searchAsync(new Query("jimmie"), completionHandler);
// Search for a first name with typo
index.searchAsync(new Query("jimie"), completionHandler);
// Search for a company
index.searchAsync(new Query("california paint"), completionHandler);
// Search for a first name and a company
index.searchAsync(new Query("jimmie paint"), completionHandler);
FAQs
This Android library lets you easily use the Algolia Search API from your Android Application, with additional offline capabilities. It wraps the Algolia Search REST API and the Algolia Search Offline Core.
We found that com.algolia:algoliasearch-offline-android demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.