-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
94 lines (89 loc) · 3.69 KB
/
index.php
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
<?php
session_start();
require_once('functions.php');
print_home_header();
if ($_GET['clear'] == 'yes') {
session_unset();
}
if (!isset($_POST['index_type'])) {
echo <<<HERE
<div class="container" style='margin-top:100px!important'>
<div class="row">
<div class="col-md-3">
<p class="help-block"><span class='glyphicon glyphicon-exclamation-sign'></span> <strong>Plain indexes</strong> (or, "batch indexes") are generated with "indexer"-- documents are indexed in batches.</p>
<p class="help-block"><span class='glyphicon glyphicon-exclamation-sign'></span> With <strong>real time indexes</strong>, indexer is not involved. You just push documents into the index and they are immediately availble for searching.</p>
<p class="help-block"><span class='glyphicon glyphicon-exclamation-sign'></span> <strong>Template indexes</strong> don't actually hold data-- they're used as "templates", to hold index settings (useful for snippets and a few other things).</p>
<p class="help-block"><span class='glyphicon glyphicon-exclamation-sign'></span> The <strong>distributed index</strong> type is really just a map that points to other instances of searchd. Your application can query this distributed index to search all the different Sphinx nodes.</p>
</div>
<div class="col-md-1"></div>
<div class="col-md-3">
<h4>Choose your index type:</h4>
<form name="type" action="index.php" method="post">
<input type="radio" name="index_type" value="plain">Plain<br />
<input type="radio" name="index_type" value="rt">Realtime<br />
<input type="radio" name="index_type" value="template">Template<br />
<input type="radio" name="index_type" value="distributed">Distributed<br />
<input type="submit" value="Submit">
</form>
</div>
</div>
</div>
</div>
HERE;
} else {
$_SESSION['index_type'] = $_POST['index_type'];
$type = $_SESSION['index_type'];
if ($_SESSION['index_type'] !== 'plain') {
echo "
<div class='container' style='margin-top:100px!important'>
<div class='row'>
<div class='col-md-6'>
<p class='help-block'>Let's build this $type index</p>
<a href='index_options.php'><button type='button' class='btn btn-success'>Go!</button></a>
";
}
if ($_SESSION['index_type'] == 'plain') {
echo <<<HERE
<div class="container" style='margin-top:100px!important'>
<div class="row">
<div class="col-md-12">
<h4 class="text-center">Environment Variables?</h4><br />
<div class='btn-group btn-group-justified text-center'>
<a href="source.php?scripted=/bin/bash"><button type='button' class='btn btn-info'>Yes</button></a>
<a href='source.php'><button type='button' class='btn btn-warning'>No</button></a>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
Using environment variables to pass host, user, password, db, and port in the source section:
<br />
</div>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6"><br />
<code>
#!/bin/bash<br />
printf "<br />
source docs<br />
{<br />
type = mysql <br />
sql_host = \$SQL_HOST <br />
sql_user = \$SQL_USER <br />
sql_pass = \$SQL_PASS <br />
sql_db = \$SQL_DB <br />
sql_port = \$SQL_PORT <br />
sql_query = select * from docs <br />
sql_field_string = title<br />
sql_field_string = content<br />
}<br />
</code><br />
</div>
</div>
HERE;
}
}
?>