Commit 2050cd13 authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Merge pull request #91 from PidgeyL/master

Fulltext search in minimal + fix typo in doc
parents 63b6aaea 5e02b5f8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@
  <h3>Fulltext Search</h3>
  <p>
    If you want to enable fulltext search, you have to enable this in the database. <br />
    To do this, log into the Mongo database (<span class="code">$ mongo</span>) and run the following command: <span class="code">db.adminCommand({"setParameter": 1, "textSearchEnabled":True})</span>. <br />
    To do this, log into the Mongo database (<span class="code">$ mongo</span>) and run the following command: <span class="code">db.adminCommand({"setParameter": 1, "textSearchEnabled":true})</span>. <br />
    <b>Note:</b> when the Mongo database is shut down, fulltext search will be disabled again. Simply run the same command again to activate it.
  </p>
  <h2>Final notes</h2>
+12 −0
Original line number Diff line number Diff line
@@ -280,6 +280,18 @@ def browse(vendor=None):
                                       'info':{'host':Configuration.getRedisHost(),'port':Configuration.getRedisPort()}})


@app.route('/search', methods=['POST'])
def searchText():
    search = request.form.get('search')
    collection = db.cves
    try:
        cvelist = db.command("text", "cves", search=search)["results"]
    except:
        return render_template('error.html', status={'except':'textsearch-not-enabled'})
    cve=[x["obj"] for x in cvelist]
    return render_template('search.html', cve=cve, minimal=True)


@app.route('/search/<vendor>/<path:product>')
def search(vendor=None, product=None):
    collection = db.cves
+25 −15
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@
    <ul class="nav nav-pills">
      <li><a href="/">Recent</a></li>
      <li><a href="/browse">Browse per vendor</a></li>
      <li>
        <div class="col-sm-3">
          <form id="tfnewsearch" method="get" class="input-group navbar-form"onsubmit="redirect(); return false;">
            <input type="text" class="form-control input-sm" id="search" placeholder="Search CVE"/>
            <span class="input-group-btn">
              <input type="submit" class="btn btn-default input-sm" value="search" />
            </span>
          </form>
        </div>
      </li>
      <ul class="nav navbar-right">
        <li><a href="https://www.circl.lu/services/cve-search/">About</a>
      </ul>