GithubHelp home page GithubHelp logo

swiftypeandroid's Introduction

Elastic Site Search Logo

⚠️ This repository is deprecated ⚠️

We are no longer maintaining an Android library for Site Search. However, you can still build excellent native and mobile web experiences with Site Search APIs and clients. Thank you! - Elastic

A first-party Android library to add Elastic Site Search to Android applications.

Contents


Getting started 🐣

Note: This client has been developed for the Swiftype Site Search API endpoints only. You may refer to the Swiftype Site Search API Documentation for additional context.

  1. Import SwiftypeAndroid into your workspace.
  2. In the properties for your application select 'Android' and add the imported project as a library
  3. Choose a search activity:
    • If your Swiftype search engine is crawler-based or WordPress-based and you would like to display results in a web view, use WebSearchActivity.
    • If you have an API-based engine, or would like different result display behavior, extend SearchActivity and create a custom ShowDetailsFragment to present the results.
  4. Add the search activity to your AndroidManifest.xml (example for WebSearchActivity):
        <activity
	      android:name="com.swiftype.android.search.webbased.WebSearchActivity"
		  android:label="@string/app_name"
		  android:windowSoftInputMode="stateAlwaysHidden"
		  android:exported="false"
		  android:launchMode="singleTop" >
		  <intent-filter>
		    <action android:name="android.intent.action.SEARCH" />
		  </intent-filter>

          <meta-data
		    android:name="android.app.searchable"
		    android:resource="@xml/searchable" />
    	</activity>
  1. Make it the default search activity for your application by adding the following lines to your main activity:
        <meta-data
		  android:name="android.app.default_searchable"
		  android:value="com.swiftype.android.search.webbased.WebSearchActivity" />
  1. Copy /res/values/swiftype_config.xml and /res/values/colors.xml (if you use a light theme) from SwiftypeAndroid. You must set the values for search_content_provider_authority and engine_key.
  2. Copy /res/xml/searchable.xml from SwiftypeAndroid to your project.
  3. Add android:configChanges="orientation|screenSize" to the application attributes in AndroidManifest.xml.
  4. Add the search provider and service to your AndroidManifest.xml:
        <provider
          android:exported="false"
          android:authorities="@string/search_content_provider_authority"
          android:name="com.swiftype.android.search.backend.SearchContentProvider" />

        <service
          android:name="com.swiftype.android.search.backend.SearchService" />
  1. Add Internet permissions to your AndroidManifest.xml:
		<uses-permission android:name="android.permission.INTERNET" />
  1. Use a SearchView or the SearchDialog to start a search. For an example, look at our SwiftypeAndroidExample repository. More information can be found in the Android Documentation.

FAQ 🔮

Where do I report issues with the client?

If something is not working as expected, please open an issue.

Where can I learn more about Site Search?

Your best bet is to read the documentation.

Where else can I go to get help?

You can checkout the Elastic Site Search community discuss forums.

Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

License 📗

MIT © Elastic

Thank you to all the contributors!

swiftypeandroid's People

Contributors

ariabov avatar dilchenko avatar goodroot avatar jasonstoltz avatar jonasll avatar qhoxie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.