Commit f95795bb authored by PidgeyL's avatar PidgeyL
Browse files

add full text search to minimal

parent 01280470
Loading
Loading
Loading
Loading
+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>