beginning of export merge
[disclosr.git] / documents / search.php
Alex Sadleir






Alex Sadleir
Alex Sadleir

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
<?php
include_once('include/common.inc.php');
include_header('Search');
?>
    <div class="foundation-header">
        <h1><a href="search.php">Search</a></h1>
    </div>
    <form>
        <input type="text" name="q" value="<?php if (isset($_REQUEST['q'])) echo $_REQUEST['q'];?>"/>
        <input type="submit"/>
    </form>
 
<?php
if (isset($_REQUEST['q'])) {
    $request = Requests::get($serverAddr . "disclosr-documents/_fti/_design/lucene/by_all?include_docs=true&q=" . $_REQUEST['q']);
    $results = json_decode($request->body);
    $db = $server->get_db('disclosr-documents');
    foreach ($results->rows as $result) {
        //print_r($result);
        //$row = $db->get($result->id);
        echo $result->doc->_id . " " . $result->doc->url . "<br>" . PHP_EOL;
    }
}
include_footer();
?>