<commit_before>﻿Hello and welcome to the Hello SRCH2 Android SDK tutorial. 

###Introduction
 
This tutorial will show you how to:

1. Incorporate the SRCH2 Android SDK into your Android Studio project
2. Create indexes and insert records
3. Enable powerful search in your app and publish the search results to the UI or main thread
 
To get started, this tutorial assumes you are familiar with Android Studio and can create, or have already created, Android Studio projects. 

Before you begin the tutorial, clone the project application from our [`hello-srch2-android-sdk` Github repository](https://github.com/SRCH2/hello-srch2-android-sdk). 

###Quick Start

1. Clone the tutorial application project from our [`hello-srch2-android-sdk` Github repository](https://github.com/SRCH2/hello-srch2-android-sdk). To do this from the command line you can enter the following git command: `clone githubrepo`
2. Open Android Studio and from the File menu option (or the Quick Start menu) select 'Open Project' choosing the root folder of the cloned project: ![Opening the cloned Hello SRCH2 Android SDK application project][tutorial-010]
3. With a device connected (currently hardware emulation does not support the SRCH2 Android SDK), from the Run menu option select 'Run app'. 
4. Once the app has launched, enter some characters in the text input field at the top of the screen and you should instantly see search results: <br>
<center>![The SRCH2 Android SDK in action!][tutorial-011]</center>
5. That's it! You're now using the SRCH2 Android SDK to power searches in an Android project with the SRCH2 search engine. 

You can read on for an explanation of the source code and how to incorporate the SRCH2 Android SDK in your own projects.

###Installing the SDK
 
The Gradle build system makes it easy to install the SRCH2 Android SDK in an Android Studio project.

1. If you have an open Android project in Android Studio, to incorporate the SRCH2 Android SDK, you will need to configure the Gradle build system to retrieve the `SRCH2-Android-SDK.aar` file from the SRCH2 server Maven repository. To do this, navigate to the top-level <code>build.gradle</code> file in your project view.
2. In the `repositories` node in the `buildscript` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`maven { url 'http://srch2.com/repo/maven' }`
3. In the `repositories` node in the `allprojects` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`maven { url 'http://srch2.com/repo/maven' }`
4. The `build.gradle` file should now look like:<br>![Including the SRCH2 server Maven repository in the top-level build.gradle file][tutorial-012] 
5. Now that the Gradle build script includes the SRCH2 server Maven repository, the SRCH2 Android SDK must be added as a dependency to the 'app' module. To do this, navigate to the `build.gradle` file in your `app` module.
6. In the `dependencies` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`compile group: 'com.srch2', name: 'srch2-android-sdk', version: '1.0.0-SNAPSHOT',  ext:'aar'`<br>The `build.gradle` file should now look like:<br>![Including the SRCH2-Android-SDK.aar file as a dependency in the app module's build.gradle file][tutorial-013] 
7. At the top of the editor window, you should be notified that Gradle needs to be synchronized. Click 'Sync Now' to refresh the Gradle build system to include these changes:<br>![Synchronizing the Gradle build system to include the new dependency][tutorial-014]
8. And that's all there is to it! To verify the SRCH2 Android SDK has been incorporated into your project, open up `SearchActivity` and try accessing the `SRCH2Engine` method `isUserAnAnteaterInATree()`: if **true**, you've successfully installed the SRCH2 Android SDK:<br>![Confirming the SRCH2 Android SDK is integrated into the application][tutorial-015]

###Creating an Index

The first step to searching an index is creating an index. Indexes in the SRCH2 search server are accessed in the SRCH2 Android SDK via the `com.srch2.android.http.service.Indexable` class. For each index to be represented and searchable, a subclass of `Indexable` must be declared:

```
public class MovieIndex extends Indexable {<commit_msg>Updated tutorial again<commit_after>﻿Hello and welcome to the Hello SRCH2 Android SDK tutorial. 

###Introduction
 
This tutorial will show you how to:

1. Incorporate the SRCH2 Android SDK into your Android Studio project
2. Create indexes and insert records
3. Enable powerful search in your app and publish the search results to the UI or main thread
 
To get started, this tutorial assumes you are familiar with Android Studio and can create, or have already created, Android Studio projects. 

Before you begin the tutorial, clone the project application from our [`hello-srch2-android-sdk` Github repository](https://github.com/SRCH2/hello-srch2-android-sdk). 

###Quick Start

1. Clone the tutorial application project from our [`hello-srch2-android-sdk` Github repository](https://github.com/SRCH2/hello-srch2-android-sdk). To do this from the command line you can enter the following git command: `clone githubrepo` (**SUBSTITE WITH REAL LINK: for now navigate to *master->srch2-android-sdk>source>Hello-SRCH2-Android-SDK and use this directory for step two**)
2. Open Android Studio and from the File menu option (or the Quick Start menu) select 'Open Project' choosing the root folder of the cloned project: ![Opening the cloned Hello SRCH2 Android SDK application project][tutorial-010]
3. With a device connected (currently hardware emulation does not support the SRCH2 Android SDK), from the Run menu option select 'Run app'. 
4. Once the app has launched, enter some characters in the text input field at the top of the screen and you should instantly see search results: <br>
<center>![The SRCH2 Android SDK in action!][tutorial-011]</center>
5. That's it! You're now using the SRCH2 Android SDK to power searches in an Android project with the SRCH2 search engine. 

You can read on for an explanation of the source code and how to incorporate the SRCH2 Android SDK in your own projects.

###Installing the SDK
 
The Gradle build system makes it easy to install the SRCH2 Android SDK in an Android Studio project.

1. If you have an open Android project in Android Studio, to incorporate the SRCH2 Android SDK, you will need to configure the Gradle build system to retrieve the `SRCH2-Android-SDK.aar` file from the SRCH2 server Maven repository. To do this, navigate to the top-level <code>build.gradle</code> file in your project view.
2. In the `repositories` node in the `buildscript` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`maven { url 'http://srch2.com/repo/maven' }`
3. In the `repositories` node in the `allprojects` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`maven { url 'http://srch2.com/repo/maven' }`
4. The `build.gradle` file should now look like:<br>![Including the SRCH2 server Maven repository in the top-level build.gradle file][tutorial-012] 
5. Now that the Gradle build script includes the SRCH2 server Maven repository, the SRCH2 Android SDK must be added as a dependency to the 'app' module. To do this, navigate to the `build.gradle` file in your `app` module.
6. In the `dependencies` node, add the entry:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`compile group: 'com.srch2', name: 'srch2-android-sdk', version: '1.0.0-SNAPSHOT',  ext:'aar'`<br>The `build.gradle` file should now look like:<br>![Including the SRCH2-Android-SDK.aar file as a dependency in the app module's build.gradle file][tutorial-013] 
7. At the top of the editor window, you should be notified that Gradle needs to be synchronized. Click 'Sync Now' to refresh the Gradle build system to include these changes:<br>![Synchronizing the Gradle build system to include the new dependency][tutorial-014]
8. And that's all there is to it! To verify the SRCH2 Android SDK has been incorporated into your project, open up `SearchActivity` and try accessing the `SRCH2Engine` method `isUserAnAnteaterInATree()`: if **true**, you've successfully installed the SRCH2 Android SDK:<br>![Confirming the SRCH2 Android SDK is integrated into the application][tutorial-015]

###Creating an Index

The first step to searching an index is creating an index. Indexes in the SRCH2 search server are accessed in the SRCH2 Android SDK via the `com.srch2.android.http.service.Indexable` class. For each index to be represented and searchable, a subclass of `Indexable` must be declared:

```
public class MovieIndex extends Indexable {
{'fraction_non_alphanumeric': 0.08075480543834974, 'fraction_numerical': 0.016643225503984997, 'mean_word_length': 4.913374913374914, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 32, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6062053', 'n_tokens_mistral': 2462, 'n_tokens_neox': 2309, 'n_words': 1184}