This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
get_started.html
406 lines (353 loc) · 16.1 KB
/
get_started.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
{% extends "common-base.html" %}
{% load custom_tags %}
{% load humanize %}
{% load mixpanel %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% static 'common/js/function01.js' %}"></script>
<script>
$(window).ready(function() {
$('#signup').submit(function() {
try {
$.ajax(
{
type: "POST",
data: { 'email': $('#email').val() },
dataType: 'json',
success: function(data, text, x) {
//$('#email').val(data['api_key']);
$('#get_api_url').hide();
$('.user_email').text(data['email']);
$('.logged_out').hide();
$('.logged_in').show();
$('.private_apiurl').text(data['private_api_url']);
$('.public_apiurl').text(data['public_api_url']);
$('#account_created').show();
// if you wanted to use some tracking tool (mixpanel, google analytics? ),
// this is the place to callback the service
},
error: function(x, text, err) {
$('#email_error').text(x.responseText);
$('.signup').val('SIGN UP');
}
}
);
$('#email_error').text('')
$('.signup').val('...');
} finally {
return false;
}
});
});
</script>
{% endblock %}
{% block title %}Get Started{% endblock %}
{% block tryit %}{% endblock %}
{% block right_content %}
{% box 'blue_box01' %}
<p>
Free for first 100K docs.<br />
$49/month for 500k docs.<br />
$175/month for 2M docs.<br />
Upgrade anytime.<br />
</p>
<div class="red_btn"> <a href="{% url pricing %}">CHOOSE PLAN</a> </div>
{#<p class="size"><a href="mailto:support@indextank.com">Email us</a> if you have more than 500K docs for special pricing.</p>#}
{% endbox %}
{% box 'chat' %}
<h2>HAVE A QUESTION?</h2>
<div class="chat_btn"><a href="javascript:void(0)" onclick="go_chat()">LIVE CHAT NOW</a><span class="clear"></span></div>
<p>Our team of experienced and friendly devs will respond almost as quickly as our search API.</p>
{% endbox %}
{% endblock %}
{% block common_content %}
{% if package.base_price %}
{% include "includes/chosen_plan.html" %}
{% else %}
<h2 style="margin:0; padding:0">Try it Free in under 2 minutes</h2>
{% endif %}
<ul>
<li>
<h3 style="margin-top:0">1. Get your API urls</h3>
{% if not request.user.is_authenticated %}
<div id="get_api_url">
<p>Enter your email address to get API Urls:</p>
<form id="signup">
<div class="form_sec">
<div class="input_bg">
<label><span class="none"> </span>
<input type="text" emptyvalue="Email" class="empty" name="" id="email" />
</label>
</div>
<label>
<input type="submit" value="SIGN UP" class="signup"/>
<span class="none"> </span> </label>
<div id="email_error"></div>
</div>
</form>
</div>
{% endif %}
<div id="account_created" {% if not request.user.is_authenticated %}style="display:none"{% endif %}>
<p>Welcome <span class="user_email">{{ request.user.username }}</span>, your account has been successfully created. {#Please confirm your email address within the next 24hs, otherwise your account will be deleted.#}</p>
{% if package.base_price > 0 %}
{% if not user.is_authenticated or request.user.get_profile.account.status == "CREATING" %}
<div class="messages warning" style="margin: 20px 35px 15px 40px; font-weight: normal;">
Before you start using your account, you'll need to <br><a href="{% url enter_payment %}">enter your payment information</a>
</div>
{% endif %}
{% endif %}
<p>Here are the urls you need to access your API:</p>
{% bg 'commands' %}
<div class="commands_main apiurl">
<h4>Private API url: {% with request.user.get_profile.account.get_private_apiurl as text %}{% include 'includes/clippy.html' %}{% endwith %}</h4>
<a style="color:#3B8DB8; font-weight:bold; font-size:14px;" href="{{ request.user.get_profile.account.get_private_apiurl }}" class="private_apiurl">{{ request.user.get_profile.account.get_private_apiurl }}</a>
</div>
{% endbg %}
{% bg 'commands' %}
<div class="commands_main apiurl">
<h4>Public API url: {% with request.user.get_profile.account.get_public_apiurl as text %}{% include 'includes/clippy.html' %}{% endwith %}</h4>
<a style="color:#3B8DB8; font-weight:bold; font-size:14px;" href="{{ request.user.get_profile.account.get_public_apiurl }}" class="public_apiurl">{{ request.user.get_profile.account.get_public_apiurl }}</a>
</div>
{% endbg %}
</div>
</li>
<li>
<h3 style="margin-top:0">2. Install Library</h3>
<div class="work_tab">
<ul>
<li><a href="javascript:void(0);" rel="content1" class="active"><span><img src="{% static 'common/images/work_icon03.gif' %}" alt="ruby" /></span></a></li>
<li><a href="javascript:void(0);" rel="content2"><span><img src="{% static 'common/images/work_icon02.gif' %}" alt="python" /></span></a></li>
<li><a href="javascript:void(0);" rel="content3"><span><img src="{% static 'common/images/work_icon04.gif' %}" alt="php" /></span></a></li>
<li><a href="javascript:void(0);" rel="content4"><span><img src="{% static 'common/images/work_icon01.gif' %}" alt="java" /></span></a></li>
<li><a href="javascript:void(0);" rel="content5"><span><img src="{% static 'common/images/work_icon05.png' %}" alt="other" /></span></a></li>
</ul>
<span class="clear"></span>
</div>
{% bg 'work' %}
<div class="work_main content1" style="display:block;">
<p>For Ruby environments we provide a gem that handles all the REST calls for you in a very Ruby-fashioned way.</p>
<p> </p>
<p><b>Install our client:</b> <span style="font-family: 'Courier new'; font-size: 12px;">gem install indextank</span> {% with "gem install indextank" as text %}{% with "1" as small %}{% with "#999999" as bgcolor %}{% include 'includes/clippy.html' %}{% endwith %}{% endwith %}{% endwith %}
</p>
<p><b>Look at the client's <a href="http://github.com/flaptor/indextank-rb">source code</a></b></p>
<p><b>Read the client <a href="{% url documentation path='ruby-client' %}">documentation</a></b></p>
</div>
<div class="work_main content2" style="display:none;">
<p>For Python environments we provide a package that handles all the REST calls for you. You can install it with Pip or download the library:</p>
<p> </p>
<p><b>Install our client:</b> <span style="font-family: 'Courier new'; font-size: 12px;">pip install indextank</span> {% with "pip install indextank" as text %}{% with "1" as small %}{% with "#999999" as bgcolor %}{% include 'includes/clippy.html' %}{% endwith %}{% endwith %}{% endwith %}
<p><b> Or Download Stable version:
<a href="http://github.com/flaptor/indextank-py/zipball/stable">ZIP file</a> |
<a href="http://github.com/flaptor/indextank-py/tarball/stable">TGZ file</a>
</b></p>
<p><b>Look at the client's <a href="http://github.com/flaptor/indextank-php">source code</a></b></p>
<p><b>Read the client <a href="{% url documentation path='python-client' %}">documentation</a></b></p>
</div>
<div class="work_main content3" style="display:none;">
<p>For Php environments we provide a client that handles all the REST calls for you. Download a file that comes with the library ready to use.</p>
<p> </p>
<p><b>Download Stable version:
<a href="http://github.com/flaptor/indextank-php/zipball/stable">ZIP file</a> |
<a href="http://github.com/flaptor/indextank-php/tarball/stable">TGZ file</a>
</b></p>
<p><b>Look at the client's <a href="http://github.com/flaptor/indextank-php">source code</a></b></p>
<p><b>Read the client <a href="{% url documentation path='php-client' %}">documentation</a></b></p>
</div>
<div class="work_main content4" style="display:none;">
<p>For Java environments we provide a basic API client that handles all the REST calls for you and translates the responses to simple Java objects.</p>
<p> </p>
<p><b>Download Stable version:
<a href="http://github.com/flaptor/indextank-java/zipball/stable">ZIP file</a> |
<a href="http://github.com/flaptor/indextank-java/tarball/stable">TGZ file</a>
</b></p>
<p><b>Or add our maven client to your dependencies:</b></p>
<pre style="font-family: 'Courier new'; font-size: 12px;">
<groupId>com.indextank</groupId>
<artifactId>indextank-java</artifactId>
<version>1.0.6</version></pre>
<p><b>Look at the client's <a href="http://github.com/flaptor/indextank-java">source code</a></b></p>
<p><b>Read the client <a href="{% url documentation path='java-client' %}">documentation</a></b></p>
</div>
<div class="work_main content5" style="display:none;">
<p>There might be an open source tool better suited to your needs. Check out the list maintained <a href="http://blog.indextank.com/737/the-state-of-the-indextank-ecosystem/">on our blog</a>.</p>
<p> </p>
</div>
{% endbg %}
</li>
<li>
<h3 style="margin-top:0">3. Test your account</h3>
<p>First step is to instantiate the client</p>
<div class="content1">
{% box 'commands' %}
<pre class="sh_ruby">
require 'rubygems'
require 'indextank'
api_url = "<span class="private_apiurl">{% if request.user.is_authenticated %}{{ request.user.get_profile.account.get_private_apiurl }}{% else %}<YOUR API URL HERE>{% endif %}</span>"
api = IndexTank::Client.new api_url
</pre>
{% endbox %}
</div>
<div class="content2" style="display:none">
{% box 'commands' %}
<pre class="sh_python">
from indextank.client import ApiClient
import time
api = ApiClient('<span class="private_apiurl">{% if request.user.is_authenticated %}{{ request.user.get_profile.account.get_private_apiurl }}{% else %}<YOUR API URL HERE>{% endif %}</span>')
</pre>
{% endbox %}
</div>
<div class="content3" style="display:none">
{% box 'commands' %}
<pre class="sh_php">
include_once "indextank_client.php";
$API_URL = '<span class="private_apiurl">{% if request.user.is_authenticated %}{{ request.user.get_profile.account.get_private_apiurl }}{% else %}<YOUR API URL HERE>{% endif %}</span>';
$client = new ApiClient($API_URL);
</pre>
{% endbox %}
</p>
</div>
<div class="content4" style="display:none">
{% box 'commands' %}
<pre class="sh_java">
import com.flaptor.indextank.apiclient.IndexTankClient;
import com.flaptor.indextank.apiclient.IndexTankClient.Index;
import com.flaptor.indextank.apiclient.IndexTankClient.Query;
public class IndexTankTest {
private final static String API_URL =
"<span class="private_apiurl">{% if request.user.is_authenticated %}{{ request.user.get_profile.account.get_private_apiurl }}{% else %}<YOUR API URL HERE>{% endif %}</span>";
public static void main(String[] args) {
IndexTankClient client = new IndexTankClient(API_URL);
}
}
</pre>
{% endbox %}
</div>
<div class="clear"></div>
<p class="pad04">Next, you need to get an index to start playing, you can create directly with the client.</p>
<div class="content1">
{% box 'commands' %}
<pre class="sh_ruby">
index = api.indexes "MyFirstIndex"
index.add
while not index.running?
sleep 0.5
end
</pre>
{% endbox %}
</div>
<div class="content2" style="display:none">
{% box 'commands' %}
<pre class="sh_python">
index = api.create_index('MyFirstIndex')
while not index.has_started():
time.sleep(0.5)
</pre>
{% endbox %}
</div>
<div class="content3" style="display:none">
{% box 'commands' %}
<pre class="sh_php">
$index = $client->create_index("MyFirstIndex");
while (!$index->has_started()) {
sleep(1);
}
</pre>
{% endbox %}
</p>
</div>
<div class="content4" style="display:none">
{% box 'commands' %}
<pre class="sh_java">
Index index = client.createIndex("test_name");
while (!index.hasStarted()) {
Thread.sleep(300);
}
</pre>
{% endbox %}
</div>
<div class="clear"></div>
<p class="pad04">Now that you have created an index, and it has started, you can index documents and do queries.</p>
<div class="content1">
{% box 'commands' %}
<pre class="sh_ruby">
docid = "MyDoc"
text = "some sample text"
index.document(docid).add({ :text => text })
results = index.search "some text"
print results['matches'], " results\n"
results['results'].each {|doc|
docid = doc['docid']
print "docid: #{docid}"
}
</pre>
{% endbox %}
</div>
<div class="content2" style="display:none">
{% box 'commands' %}
<pre class="sh_python">
id = 'MyDoc'
text = 'some sample text'
index.add_document(id, { 'text': text })
results = index.search('some text')
print '%d results' % results['matches']
for doc in results['results']:
print 'docid: %s' % doc['docid']
</pre>
{% endbox %}
</div>
<div class="content3" style="display:none">
{% box 'commands' %}
<pre class="sh_php">
$doc_id = 'MyDoc';
$text = 'some sample text';
$index->add_document($doc_id, array('text'=>$text));
$res = $index->search('some text');
echo $res->matches . " results\n";
foreach($res->results as $doc) {
print_r($doc);
echo "\n";
}
</pre>
{% endbox %}
</p>
</div>
<div class="content4" style="display:none">
{% box 'commands' %}
<pre class="sh_java">
String documentId = "MyDoc";
Map<String, String> fields = new HashMap<String, String>();
fields.put("text", "some sample text");
index.addDocument(documentId, fields);
SearchResults results = index.search(Query.forString("some text"));
System.out.println("Matches: " + results.matches);
for (Map<String, Object> document : results.results) {
System.out.println("doc id: " + document.get("docid"));
}
</pre>
{% endbox %}
</div>
<div class="clear"></div>
<div class="content1">
<p class="pad04">You have successfully created an index and performed queries. See what else
you can do with the <a href="{% url documentation path='ruby-client' %}">Ruby client</a>, or
try <a href="{% url demoindex %}">searching</a> over your own test index.
</div>
<div class="content2" style="display:none">
<p class="pad04">You have successfully created an index and performed queries. See what else
you can do with the <a href="{% url documentation path='python-client' %}">Python client</a>, or
try <a href="{% url demoindex %}">searching</a> over your own test index.
</div>
<div class="content3" style="display:none">
<p class="pad04">You have successfully created an index and performed queries. See what else
you can do with the <a href="{% url documentation path='php-client' %}">PHP client</a>, or
try <a href="{% url demoindex %}">searching</a> over your own test index.
</div>
<div class="content4" style="display:none">
<p class="pad04">You have successfully created an index and performed queries. See what else
you can do with the <a href="{% url documentation path='java-client' %}">Java client</a>, or
try <a href="{% url demoindex %}">searching</a> over your own test index.
</div>
<p class="pad04">Don't forget to checkout your account's <a href="{% url dashboard %}">dashboard</a></p>
</li>
</ul>
{% endblock %}