<h1 class="my-3">Export From Crawl Data</h1>

<div class="my-3 p-3 border bg-light">
    This will run an extraction job against a crawl data set.  The generated data will be available as
    an <a href="/nodes/{{node.id}}/storage/exports">export object</a>.
</div>

<form method="post" action="actions/export-from-crawl-data" onsubmit="return confirm('Confirm export')">
    <h2>Select a source</h2>

    <table class="table">
        <tr>
            <th>Use</th>
            <th>Path</th>
            <th>Description</th>
            <th>Details</th>
        </tr>
        {{#each allCrawlData}}
            <tr>
                <td><input {{#if active}}checked{{/if}}  {{#if new}}disabled{{/if}} {{#if delete}}disabled{{/if}}  class="form-check-input" type="radio" name="source" id="{{id}}" value="{{id}}"></td>
                <td><label for="{{id}}" class="form-check-label" >{{path}}</label></td>
                <td>{{description}}
                    <span class="text-danger">{{#if new}}[CREATING]{{/if}}</span>
                    <span class="text-danger">{{#if delete}}[DELETING]{{/if}}</span>
                </td>
                <td><a href="/nodes/{{node}}/storage/details?fid={{id}}">[Details]</a></td>
            </tr>
        {{/each}}
    </table>

    <h2>Select the export operation to run</h2>
    <div class="form-check">
        <input class="form-check-input" type="radio" name="exportType" id="exportTypeAtags" value="atags">
        <label class="form-check-label" for="exportTypeAtags">
            Extract anchor texts
        </label>
        <div>
            <small class="text-muted">
                Creates a CSV file with information related to external anchor tags.  External anchor tags can be
                used to improve search result accuracy, since they often describe what they are linking to better than
                the destination page itself.
            </small>
        </div>
    </div>
    <div class="form-check">
        <input class="form-check-input" type="radio" name="exportType" id="exportTypeRSS" value="rss">
        <label class="form-check-label" for="exportTypeRSS">
            Extract RSS feeds
        </label>
        <div>
            <small class="text-muted">
                Run a best-effort attempt at extracting RSS and Atom feeds from the crawl data.  The operation
                will only consider the root page of each crawl data set.  It will only extract the shortest
                feed URL from each document.  The result is a CSV.  The CSV will contain the domain name,
                the feed URL, and the number of documents in the crawl data set for that particular domain.
            </small>
        </div>
    </div>
    <div class="form-check">
        <input class="form-check-input" type="radio" name="exportType" id="exportTypeTermFreq" value="termFreq">
        <label class="form-check-label" for="exportTypeTermFreq">
            Extract term frequency data
        </label>
        <div>
        <small class="text-muted">
            Creates a binary data file consisting of term hashes and frequencies.  This is the TF- side of TF-IDF,
            and is used to evaluate the importance of a term in relation to its frequency in a document.
        </small>
        </div>
    </div>
    <div class="my-3 py-3">
        <div class="row">
            <div class="col">
                <button type="submit" class="btn btn-primary">Export</button>
            </div>
        </div>
    </div>
</form>