include 'db.php';
include 'queries.php';
include 'classes.php';
if (isset($_POST['keyword'])) {
    $keyword = $_POST['keyword'];
    $keys = explode(' ', $keyword);
    /*create dictionary starts*/
    $t_create_start = microtime(true);
    $qobj = new Queries();
    $btree = new BTree();
    $btreeop = new BOperation();
    $content = array();
    $contentlist = array();
    $docidlist = array();
    $doclist = $qobj->retrieve_documents($conn);
    while ($row = $doclist->fetch()) {
        echo $row['doc_id'] . " => ";
        echo $row['content'];
        $content = explode(' ', $row['content']);
        array_push($docidlist, $row['doc_id']);
        array_push($contentlist, $content);
        echo "<br>";
    }
    $collection = array_combine($docidlist, $contentlist);
    $dictionary = array();
    $l = array();
    // create dictionary list
    foreach ($collection as $doc => $content) {
        foreach ($content as $i => $word) {
            $word = strtolower($word);