Pulling Data from Two Sources

                  This is the full production version in action.
The Flask code. Using Python 3.8.10

            from flask import Flask, session, redirect, url_for, request, render_template, jsonify, make_response, json, jsonify
            from markupsafe import escape
            import pymongo
            from pymongo import MongoClient
            import sys
            from datetime import datetime
            import requests
            import json
            import time


            from flask_wtf.csrf   import CSRFProtect

            app = Flask(__name__)
            app.secret_key = b'_5#y2Lklit"]'


            csrf = CSRFProtect(app)

            output_terms = {}


            app.secret_key = b'_5#y2L"F4Q8]/'


            @app.after_request
            def add_headers(response):
                response.headers.add('Access-Control-Allow-Origin', '*')
                response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
                return response



            @app.route('/aplusb', methods=['GET', 'POST'])
            def aplusb():

                route = "/aplusb"
                control = 1

                number_of_terms = 5

                return render_template('slug.html',term_number=number_of_terms, title='arXiv + DOAJ', route="aplusb", output="aplusb_output", control=control)



            @app.route('/aplusb_output', methods=['POST'])
            def aplusb_output():

                return render_template('aplusb_output.html')




            @app.route('/')
            def hello():
                return render_template('index.html')


            @app.route('/signUpUser2', methods=['POST'])
            def signUpUse2():
                user =  request.form['username'];

                weight = request.form['password'];
                source = request.form['source']
                time.sleep(1)


                result = user.find('(')
                page_counter = user[result+1:]

                resultb = page_counter.find(')')
                page_counter = page_counter[0:resultb]

                user = user[0:result]

                user = user.replace(" ", "+")
                url = "https://doaj.org/api/v2/search/articles/'" + user + "'?page=" +  page_counter + "&pageSize=100&sort=created_date%3Adesc"

                response = requests.get(url)

                text_output = ""

                if response.text != "none":
                    text_output = "score:" + weight + ":" + response.text

                return json.dumps({'status':'OK','user':user, 'weight': weight,'text':response.text, 'source':source});


            @app.route('/signUpUser4', methods=['POST'])
            def signUpUse4():
                user =  request.form['username'];
                weight = request.form['password'];
                source = request.form['source']

                user = user.replace(" ", "+")

                url = "http://export.arxiv.org/api/query?search_query=ti:%22" + user + "%22&sortBy=lastUpdatedDate&sortOrder=descending&start=0&max_results=500"

                response = requests.get(url)

                text_output = ""

                if response.text != "none":
                    text_output = "score:" + weight + ":" + response.text

                return json.dumps({'status':'OK','user':user, 'weight': weight,'text':response.text, 'source':source});
              

                  These imports are overkill. I was not willing to figure out which imports that I use are not needed for this code.                   When you fire up this code you will get errors. There are dependencies which need to be met.                   Just look up the error to find out which software you need to load.

                  from flask import Flask, session, redirect, url_for, request, render_template, jsonify, make_response, json, jsonify
                  from markupsafe import escape
                  import pymongo
                  from pymongo import MongoClient
                  import sys
                  from datetime import datetime
                  import requests
                  import json
                  import time

                  from flask_wtf.csrf   import CSRFProtect\n'
                 

                  For the first line refer to quickstart.                   The second two lines are for security. Please refer to CSRF Protection.

                  app = Flask(__name__)

                  csrf = CSRFProtect(app)

                  app.secret_key = 'b_5#y'
                  

                  Refer to Flask API

                  @app.after_request
                  def add_headers(response):
                      response.headers.add('Access-Control-Allow-Origin', '*')
                      response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
                      return response
                  

                  slug.html is a utility template.                   term_number is the number of terms displayed on the page.                   title is the title which will be displayed on the utility/slug page                   route is to keep track of the input page.                   aplusb_output is the resulting output page

                  @app.route('/aplusb', methods=['GET', 'POST'])
                  def aplusb():

                      return render_template('slug.html',term_number=5, title='arXiv + DOAJ', route='aplusb', output='aplusb_output')\n"
                  

                  This just calls the aplusb_output page

                  app.route('/aplusb_output', methods=['POST'])
                  aplusb_output():

                      render_template('aplusb_output.html')
                  

                  Call to the entry template.

                  app.route('/')
                  def hello():
                      return render_template('index.html')
                  

                  This code is used to take requests from the template doaj_output template.
                  Pull data from doaj.org API and then pump that out to doaj_output.
                  request.form["username"] is the term and page request for the search. It is in the form term(page_number).
                  request.form["password"] is the weight applied to the returning records.
                  request.form["source"] is the tag for where the data came from. This tells which code to use to break down the information..
                  time.sleep(1) holds up the processing for a second. We do this so that we have a gap in our requests to the server. If we overload the server it will shut us out.
                  We breakdown the variable user to obtain the term and which page to request.
                  response = requests.get(url) actually facilitates our request to the API.

                  @app.route('/signUpUser2', methods=['POST'])
                  def signUpUse2():
                      user =  request.form['username'];
                      weight = request.form['password'];
                      source = request.form['source']
                      time.sleep(1)

                      result = user.find('(')
                      page_counter = user[result+1:]

                      resultb = page_counter.find(')')
                      page_counter = page_counter[0:resultb]

                      user = user[0:result]

                      user = user.replace(" ", "+")
                      url = "https://doaj.org/api/v2/search/articles/" + user + "?page=" +  page_counter + "&pageSize=100&sort=created_date%3Adesc"

                      response = requests.get(url)

                      text_output = ""

                      if response.text != "none":
                         text_output = "score:" + weight + ":" + response.text

                      return json.dumps({'status':'OK','user':user, 'weight': weight,'text':response.text, 'source':source});
                    

                  We are making requests to the arXiv API.
                  arXiv is fairly small so taking 500 records should be enough.

                  @app.route('/signUpUser4', methods=['POST'])
                  def signUpUse4():
                      user =  request.form['username'];
                      weight = request.form['password'];
                      source = request.form['source']

                      user = user.replace(" ", "+")

                      url = "http://export.arxiv.org/api/query?search_query=ti:%22" + user + "%22&sortBy=lastUpdatedDate&sortOrder=descending&start=0&max_results=500"

                      response = requests.get(url)

                      text_output = ""

                      if response.text != "none":
                          text_output = "score:" + weight + ":" + response.text

                      return json.dumps({'status':'OK','user':user, 'weight': weight,'text':response.text, 'source':source});

                  

Templates
                  index.html
                  Really this whole page is about the button.
                  <!doctype html>

                  <head>
                      <title>aCURE</title>
                   </head>

                  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
                  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
                  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
                  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
                  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

                  <style type="text/css" media="all">

                  body {
                       font-size: 1em;
                       background-color: #00000;
                       color:#FF2020;
                       font-family:Georgia, serif;
                     }

                  p {
                      color: red;
                      text-align: center;
                  }

                  .center {
                    margin: auto;
                  }

                  #b {
                     width:100%;
                     height:56px;
                     position:relative;
                     top:0px;
                     left:0px;
                     background-color:#a63708;
                     font-family:Georgia, serif;
                     display: flex;
                     align-items: center;
                     justify-content: center;
                  }

                  #button5 {
                    border:0px solid black;
                    display:flex;
                    align-items:left;
                    position:absolute;
                    left:50px;
                    top: 85%;
                  }

                  #footer {
                     position:absolute;
                     bottom:0;
                     height:40px;   /* Height of the footer */
                     background:#ffffff;
                     color:#000000;
                     font-size: 1em;
                     alignment-adjust:central;
                     left:150px;
                     right:150px;
                  }

                  #footer {
                        clear:both;
                        padding: 1em;
                        border-top: 1px solid #133;
                        text-align: center;
                  }
                  </style>

                  <!--- creates caching  --->
                  <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

                  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

                  <meta http-equiv="expires" content="0">

                  <html>

                    <body>

                      <div id="button5">
                          <button type="button" onclick=location.href="{{ url_for('aplusb')}}" class="btn btn-dark btn-sm">arXiv + DOAJ</button<
                      </div>

                    </body>

                  </html>

                
                  slug.html
                  I use this as a semi universal template.
                <!doctype html>
                <head>
                  <title>aCURE</title>
                  <meta http-equiv="refresh" content="3500;url='/'" />

                  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
                  <-- jQuery first, then Popper.js, then Bootstrap JS -->
                  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
                  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
                  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>



                 <style type="text/css" media="all">

                 body {
                       background-color: #F3F3F3;
                      color: #000000;
                      font-family:Georgia, serif;
                    }

                    #a {
                        position: absolute;
                        top: 0;
                        right: 0;
                        height: 80px;
                        width: 100%;
                        background-color: white;
                    }

                    #aa {
                        position: absolute;
                        top: 42px;
                        left: 10px;
                        font-family:"Arial";
                        background-color: white;
                    }

                    #ab {
                        position: absolute;
                        top: 50px;
                        left: 141px;
                    }

                    #ac {
                        position: absolute;
                        top: 42px;
                        right: 50px;
                    }

                    #ad {
                        position: relative;
                        top: 42px;
                    }



                 #b {
                    width:100%;
                    height:56px;
                    position:relative;
                    top:82px;
                    left:0;
                    background-color:#a63708;
                    font-family:Georgia, serif;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                 }

                 #c {
                     width: 100%;
                     height: 400px;
                     position: absolute;
                     top:138px;
                     left:0px;
                     font-family:"Arial";
                     background-color: #F3F3F3;
                 }

                 .t1-legend{font:bold 14px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}
                 .t2-legend{font:14px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}


                 input[type=range] {
                     /*removes default webkit styles*/
                     -webkit-appearance: none;

                     /*fix for FF unable to apply focus style bug */
                     border: 1px solid white;

                     /*required for proper track sizing in FF*/
                     width: 200px;
                 }
                 input[type=range]::-webkit-slider-runnable-track {
                     width: 200px;
                     height: 5px;
                     background: #ddd;
                     border: none;
                     border-radius: 3px;
                 }
                 input[type=range]::-webkit-slider-thumb {
                     -webkit-appearance: none;
                     border: none;
                     height: 16px;
                     width: 16px;
                     border-radius: 50%;
                     background: #000000;
                     margin-top: -4px;
                 }
                 input[type=range]:focus {
                     outline: none;
                 }
                 input[type=range]:focus::-webkit-slider-runnable-track {
                     background: #ccc;
                 }

                 input[type=range]::-moz-range-track {
                     width: 200px;
                     height: 5px;
                     background: #ddd;
                     border: none;
                     border-radius: 3px;
                 }
                 input[type=range]::-moz-range-thumb {
                     border: none;
                     height: 16px;
                     width: 16px;
                     border-radius: 50%;
                     background: #000000;
                 }

                 /*hide the outline behind the border*/
                 input[type=range]:-moz-focusring{
                     outline: 1px solid white;
                     outline-offset: -1px;
                 }

                 input[type=range]::-ms-track {
                     width: 200px;
                     height: 5px;

                     /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
                     background: transparent;

                     /*leave room for the larger thumb to overflow with a transparent border */
                     border-color: transparent;
                     border-width: 6px 0;

                     /*remove default tick marks*/
                     color: transparent;
                 }
                 input[type=range]::-ms-fill-lower {
                     background: #777;
                     border-radius: 10px;
                 }
                 input[type=range]::-ms-fill-upper {
                     background: #ddd;
                     border-radius: 10px;
                 }
                 input[type=range]::-ms-thumb {
                     border: none;
                     height: 16px;
                     width: 16px;
                     border-radius: 50%;
                     background: #000000;
                 }
                 input[type=range]:focus::-ms-fill-lower {
                     background: #888;
                 }
                 input[type=range]:focus::-ms-fill-upper {
                     background: #ccc;
                 }

                 hr {
                   width:80%;height:1px;border-width:0;color:gray;background-color:gray;
                 }

                 </style>

                 <!--- creates caching  -->
                 <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

                 <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

                 <meta http-equiv="expires" content="0">

                 <script type="text/javascript" >

                 var number_of_terms

                 function loc_srange_value(value, Id) {
                   Id = "loc_weight"+Id;
                   document.getElementById(Id).innerHTML = value;
                 }

                 function resumes_qualifyb() {

                     if((document.Scooby11.string0.value).length < 1) {
                        alert("You must fill the first cell.");
                        document.Scooby11.string0.focus();
                        return;
                     }


                     id = "string" + 0;
                     localStorage.last_terms =""
                     i = 0
                     id = "string"+i;
                     wid = "sweight" + i;
                     weight_factor = document.getElementById(wid).value * 1

                     while(document.getElementById(id) && (document.getElementById(id).value).length > 0) {
                        weight_factor = document.getElementById(wid).value * 1
                        localStorage.last_terms =   localStorage.last_terms + document.getElementById(id).value  +  "(" + weight_factor + "),";

                        i = i + 1
                        id = "string"+i;
                        wid = "sweight" + i;
                     }

                     terms = "[" + localStorage.last_terms + "]";

                     str = localStorage.last_terms
                     localStorage.last_terms = str.substring(0, str.length - 1)
                     document.Scooby11.terms.value = localStorage.last_terms

                     document.Scooby11.submit()
                   }

                 </script>


                                   <html>
                                     <head>
                                       <body>
                                         <div id="a" align="center" valign=top>
                                           <div id="aa">
                                             <button type="button" onclick=location.href="{{ url_for('hello')}}" class="btn btn-dark btn-sm">Home</button>
                                           </div>
                                         </div>
                                         <div id="c" align=center valign=top>

                                           <form method='post'  name='Scooby11' action="/{{output}}"  onsubmit='qualifyb();'>
                                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
                                             <input type="hidden" name="num_terms" id="num_terms" value=>
                                             <input type="hidden" name="terms" id="terms" value="">


                                           <table border=0 cellpadding="5" cellspacing="5">
                                             <tr height=30>
                                               <td colspan=2>
                                               </tr>
                                               <tr>
                                                 <td align=center><legend class="t1-legend">Search Strings</legend></td&t;
                                                 <td></td>
                                                 <td></td>
                                                 <td colspan=3 align=center><legend class="t1-legend">Weight</legend></td>
                                               </tr>

                                             {%for i in range(0, term_number)%}
                                               <tr>
                                                 <td><input width=30 maxlength=50 id="string{{i}}" name="string{{i}}"   value=""></td>
                                                 <td width=10></td>
                                                 <td align=center>
                                                 <legend class="t2-legend"<<span><div id="weight">1</div></span></legend>
                                                 </td>
                                                 <td width=10></td>
                                                 <td>
                                                   <input id="sweight{{i}}" type="range" class="custom" min="-10" max="10" step="1" value="1" onchange="srange_value(this.value,{{i}})"/>
                                                 </td>
                                               </tr>
                                             {%endfor%}

                                         </table>
                                           <table border=0>
                                             <tr height=25>
                                               <td></td>
                                              </tr>
                                              <tr>
                                                 <td height=20></td>
                                               </tr>
                                               <tr>
                                               <td colspan=9 align=center> <button type="button" onclick="resumes_qualifyb()" class="btn btn-dark btn-sm"  >Start Search</button></td>
                                             </tr>
                                           </form>
                                           </table>
                                           <table>
                                             <tr height=40>
                                               <td></td>
                                             </tr>
                                           </table>
                                         </div>

                                     </body>
                                   </html>


              
                  Please refer here.
                <meta http-equiv="refresh" content="3500;url='/'" />
            
                  All the stuff below is needed to run the slider and the panels on the output page.
                  I am sure there are more efficient ways to do this.
                  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
                  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
                  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
                  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
                  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
           
                  The input elements run the sliders.
                  <style type="text/css" media="all">

                    body {
                          background-color: #F3F3F3;
                          color: #000000;
                          font-family:Georgia, serif;
                    }

                    #a {
                        position: absolute;
                        top: 0;
                        right: 0;
                        height: 80px;
                        width: 100%;
                        background-color: white;
                    }

                    #aa {
                         position: absolute;
                         top: 42px;
                         left: 10px;
                         font-family:"Arial";
                         background-color: white;
                    }


                    #b {
                        width:100%;
                        height:56px;
                        position:relative;
                        top:82px;
                        left:0;
                        background-color:#a63708;
                        font-family:Georgia, serif;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                    }

                    #c {
                        width: 100%;
                        height: 400px;
                        position: absolute;
                        top:138px;
                        left:0px;
                        font-family:"Arial";
                        background-color: #F3F3F3;
                     }

                    .t1-legend{font:bold 14px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}
                    .t2-legend{font:14px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}


                    input[type=range] {
                      /*removes default webkit styles*/
                      -webkit-appearance: none;

                      /*fix for FF unable to apply focus style bug */
                      border: 1px solid white;

                      /*required for proper track sizing in FF*/
                      width: 200px;
                    }


                    input[type=range]::-webkit-slider-runnable-track {
                      width: 200px;
                      height: 5px;
                      background: #ddd;
                      border: none;
                      border-radius: 3px;
                    }

                    input[type=range]::-webkit-slider-thumb {
                      -webkit-appearance: none;
                      border: none;
                      height: 16px;
                      width: 16px;
                      border-radius: 50%;
                      background: #000000;
                      margin-top: -4px;
                    }

                    input[type=range]:focus {
                      outline: none;
                    }


                    input[type=range]:focus::-webkit-slider-runnable-track {
                      background: #ccc;
                    }

                    input[type=range]::-moz-range-track {
                      width: 200px;
                      height: 5px;
                      background: #ddd;
                      border: none;
                      border-radius: 3px;
                   }


                   input[type=range]::-moz-range-thumb {
                     border: none;
                     height: 16px;
                     width: 16px;
                     border-radius: 50%;
                     background: #000000;
                   }

                    /*hide the outline behind the border*/
                    input[type=range]:-moz-focusring{
                      outline: 1px solid white;
                      outline-offset: -1px;
                    }

                    input[type=range]::-ms-track {
                      width: 200px;
                      height: 5px;

                      /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
                      background: transparent;

                      /*leave room for the larger thumb to overflow with a transparent border */
                      border-color: transparent;
                      border-width: 6px 0;

                      /*remove default tick marks*/
                      color: transparent;
                    }

                    input[type=range]::-ms-fill-lower {
                      background: #777;
                      border-radius: 10px;
                    }

                    input[type=range]::-ms-fill-upper {
                      background: #ddd;
                      border-radius: 10px;
                    }

                    input[type=range]::-ms-thumb {
                      border: none;
                      height: 16px;
                      width: 16px;
                      border-radius: 50%;
                      background: #000000;
                    }

                    input[type=range]:focus::-ms-fill-lower {
                      background: #888;
                    }

                    input[type=range]:focus::-ms-fill-upper {
                      background: #ccc;
                    }

                   #footer {
                     position:absolute;
                     bottom:0;
                     height:-40px;   /* Height of the footer */
                     background:#ffffff;
                     background-color: #F3F3F3;
                     color:#000000;
                     font-size: 1em;
                     alignment-adjust:central;
                     left:50px;
                     right:50px;
                   }

                    #footer {
                      clear:both;
                      padding: 1em;
                      text-align: center;
                    }

                    #footer_b {
                      position:absolute;
                      bottom:-30;
                      height:40px;   /* Height of the footer */
                      background-color: #F3F3F3;
                      color:#000000;
                      font-size: 1em;
                      alignment-adjust:central;
                      left:50px;
                      right:50px;
                      font-family:Georgia, serif;
                    }

                    #footer_b {
                      clear:both;
                      padding: 1em;

                      text-align: center;
                    }

                    hr {
                      width:80%;height:1px;border-width:0;color:gray;background-color:gray;
                    }

                  </style>


  
                  The javascript for this page.
                  The first phrase is just to make sure that at least one cell is filled.
                <script type="text/javascript" >

                function resumes_qualifyb() {

                    if((document.Scooby11.string0.value).length < 1) {
                       alert("You must fill the first cell.");
                       document.Scooby11.string0.focus();
                       return;
                    }

                    id = "string" + 0;
                    i = 0
                    id = "string"+i;
                    wid = "sweight" + i;

                    localStorage.last_terms = ""

                    while(document.getElementById(id) && (document.getElementById(id).value).length > 0) {
                       weight_factor = document.getElementById(wid).value * 1
                       localStorage.last_terms =   localStorage.last_terms + document.getElementById(id).value  +  "(" + weight_factor + "),";
                       i = i + 1
                       id = "string"+i;
                       wid = "sweight" + i;
                    }

                    str = localStorage.last_terms
                    localStorage.last_terms = str.substring(0, str.length - 1)
                    document.Scooby11.terms.value = localStorage.last_terms

                    document.Scooby11.submit()
                  }

                  function srange_value(value, Id) {
                    Id = "weight"+Id;
                    document.getElementById(Id).innerHTML = value;
                  }

                </script>
                  aplusb_output.html
                  This is the ouput page for the search combining arXib and DOAJ.
                <!DOCTYPE html>
                <html lang="en">

                    <head>
  	                <meta charset="utf-8">
  	                <meta http-equiv="X-UA-Compatible" content="IE=edge">
  	                <meta name="viewport" content="width=device-width, initial-scale=1">
  	                <meta name="description" content="">
  	                <meta name="author" content="">

  	                <title<aCURE</title>
                        <meta http-equiv="refresh" content="3500;url='/'" />


  	                <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
  	                <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  	                <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  	                <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
  	                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

  	                <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>


                    </head>
                    <style type="text/css" media="all">

                        body {
                              background-color: #F3F3F3;
                              color: #000000;
                              font-family:Georgia, serif;
                            }


  	                .t1-score{color:red}

                        a:link {
  	                        font-size:20px;
  	                        color: #000000;
  	                        font-style:normal;
          	                font-family:Helvetica Neue,Helvetica,sans-serif;
  	                        font-weight:bold;
  	                        text-decoration: none;
                               }

  	                 a:visited {
  	                            font-size:20px;
  	                            color: #939393;
  	                            font-style:normal;
  	                            font-family:Helvetica Neue,Helvetica,sans-serif;
  	                            font-weight:bold;
  	                            text-decoration: none;
  	                           }

                         #a {
                             position: absolute;
                             top: 0;
                             right: 0;
                             height: 80px;
                             width: 100%;
                             background-color: white;
                            }

  	                  #ad {
                               position: relative;
                               top: 42px;
                              }

                          #aa {
                               position: absolute;
                               top: 42px;
                               left: 10px;
                               font-family:"Arial";
                               background-color: white;
                              }

                          #ab {
                               position: absolute;
                               top: 42px;
                               left: 141px;
                              }

                          #ac {
                               position: absolute;
                               top: 42px;
                               right: 50px;
                              }

                          #b {
                              width:100%;
                              height:56px;
                              position:relative;
                              top:82px;
                              left:0;
                              background-color:#a63708;
                              font-family:Georgia, serif;
                              display: flex;
                              align-items: center;
                              justify-content: center;
                             }

                          #c {
                               width: 100%;
                               height: 700px;
                               position: absolute;
                               top:138px;
                               left:0px;
                               font-family:Georgia, serif;
                               background-color: #F3F3F3;
                             }


                          .t1-legend{font:bold 20px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}
                          .t2-legend{font:20px Helvetica Neue,Helvetica,sans-serif;font-size:20px;color:#000000}


                          input[type=range] {
                                             /*removes default webkit styles*/
                                             -webkit-appearance: none;

                                             /*fix for FF unable to apply focus style bug */
                                             border: 1px solid white;

                                             /*required for proper track sizing in FF*/
                                             width: 200px;
                                            }


                          input[type=range]::-webkit-slider-runnable-track {
                            width: 200px;
                            height: 5px;
                            background: #ddd;
                            border: none;
                            border-radius: 3px;
                          }


                          input[type=range]::-webkit-slider-thumb {
                            -webkit-appearance: none;
                            border: none;
                            height: 16px;
                            width: 16px;
                            border-radius: 50%;
                            background: #207fef;
                            margin-top: -4px;
                          }

                          input[type=range]:focus {
                            outline: none;
                          }

                         input[type=range]:focus::-webkit-slider-runnable-track {
                           background: #ccc;
                         }

                         input[type=range]::-moz-range-track {
                           width: 200px;
                           height: 5px;
                           background: #ddd;
                           border: none;
                           border-radius: 3px;
                         }

                         input[type=range]::-moz-range-thumb {
                           border: none;
                           height: 16px;
                           width: 16px;
                           border-radius: 50%;
                           background: #3498db;
                         }

                         /*hide the outline behind the border*/
                         input[type=range]:-moz-focusring{
                           outline: 1px solid white;
                           outline-offset: -1px;
                         }

                         input[type=range]::-ms-track {
                           width: 200px;
                           height: 5px;

                           /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
                           background: transparent;

                           /*leave room for the larger thumb to overflow with a transparent border */
                           border-color: transparent;
                           border-width: 6px 0;

                           /*remove default tick marks*/
                           color: transparent;
                         }

                         input[type=range]::-ms-fill-lower {
                           background: #777;
                           border-radius: 10px;
                         }

                         input[type=range]::-ms-fill-upper {
                           background: #ddd;
                           border-radius: 10px;
                         }

                         input[type=range]::-ms-thumb {
                           border: none;
                           height: 16px;
                           width: 16px;
                           border-radius: 50%;
                           background: #3498db;
                         }

                         input[type=range]:focus::-ms-fill-lower {
                           background: #888;
                         }

                         input[type=range]:focus::-ms-fill-upper {
                           background: #ccc;
                         }

                         #footer_b {
                           position:absolute;
                           bottom:-30;
                           height:40px;   /* Height of the footer */
                           background-color: #F3F3F3;
                           color:#000000;
                           font-size: 1em;
                           alignment-adjust:central;
                           left:150px;
                           right:150px;
                           font-family:Georgia, serif;
                         }

                         #footer_b {
                           clear:both;
                           padding: 1em;
                           border-top: 1px solid #133;
                           text-align: center;
                         }

                         table {
                           border-collapse: collapse;
                           width: 100%;
                           background-color: #F3F3F3;
                        }

                        td {
                            padding: 30px;
                            text-align: left;
                            border-bottom: 1px solid #ddd;
                         }

                         td:hover{background-color:#f5f5f5}

                         td {
                             height: 50px;
                             vertical-align: top;
                             text-align: center;
                         }

                         th {
                             height: 20px;
  		                       width: 15%;
                             vertical-align: top;
                             text-align: center;
  		                       padding: 10px;
                         }

                         td:hover{background-color:#ffffff}

                         .t {
  	                         display: table;
                             width: 95%;
  	                         padding: 5px;
                          }

                    </style>

                <!--- creates caching  -->
                <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

                <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

                <meta http-equiv="expires" content="0">



                <body>

                  <form class="form-signin"  role="form">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }|" />
                    <input type="hidden" id="inputUsername" name="username" class="form-control" >
                    <input type="hidden" id="inputPassword" name="password" class="form-control">
                    <input type="hidden" id="inputSource" name="source" class="form-control">
                    <input type="hidden" id="route" name="route" class ="form_control" value="doaj">
                  </form>

                  <div id="a">
                    <div id="ad" align="center">
                    </div>
                    <div id="aa">
                      <button type="button" onclick=location.href="/" class="btn btn-dark btn-sm">Home</button>
                    </div>

                    <div id="ac">
                      <button type="button" onclick=location.href="/aplusb" class="btn btn-dark btn-sm">New Search</button>
                    </div>
                  </div>

                  <div id="b" align=center valign=top>
                    <font color=white size=20px<aCURE Arxiv + DOAJ Output</font<
                  </div>

                  <div id="c" align=center<

                    <div id="results" align=center>
                    </div>

                    <div id="footer_b" align=left&bt;
                    </div>

                 </div>

           </body>

      </html>


                // page_counter    is the number of times we display the information between the red strip
                //                 and the copyright notice.
                // x_count         is telling us if we have more information left on this page
                //                 anything above -1 means yes
                // substring_count is not a good name.  It keeps track of the number of anchors that have not been
                //                 been re entered into the system after a record confilict.
                // breakdown_count

              <script>
                page_counter = 0
                breakdown_count = 0
                x_count = 0
                var substring_count = 0

                function breakdown_arxiv(resp){

                  while (x_count > -1) {
                     text_response = text_response.substring(x)
                     y = text_response.indexOf('<id>')
                     text_response = text_response.substring(y+4)
                     y = text_response.indexOf('</id>')
                     url = text_response.substring(0,y)

                     y = text_response.indexOf('<title>')
                     text_response = text_response.substring(y+7)
                     y = text_response.indexOf('</title')
                     title = text_response.substring(0,y)

                     anchor = ' <a href="' + url + '" target="_blank">' + title  + '</a>'

                     chipped(anchor, resp.weight)
                     x_count = text_response.indexOf('<entry>')
                  }
                }


                function breakdown_DOAJ(resp) {

                  x = text_response.indexOf('"link":')
                  count = 0
                  while (x > -1) {
                    text_response = text_response.substring(x+9)
                    x = text_response.indexOf('"http')
                    url = text_response.substring(x + 1)
                    x = url.indexOf('"}]')
                    url = url.substring(0,x)

                    x = text_response.indexOf('"title":')
                    text_response = text_response.substring(x+10)
                    x = text_response.indexOf('"},')
                    title = text_response.substring(0,x)
                    x = title.indexOf('",')
                    if(x > -1) {
                      title = title.substring(0,x)
                    }

                    anchor = ' <a href="' + url + '" target="_blank">' + title  + '</a>'

                    //  here we are checking to see if the term and anchor have been entered
                    //  before. This prevents people from putting search terms in multiple
                    //  times
                    chipped(anchor, resp.weight)
                    x = text_response.indexOf('"link":')
                  }

                }


                function chipped(anchor, multi) {
                  var requested = indexedDB.open(dbName, 2);

                  requested.onsuccess = function(ev) {
                    var db = ev.target.result;
                    var transaction = db.transaction(["customers"],"readwrite");
                      //Ask for the objectStore
                    var store = transaction.objectStore("customers");

                    multi = multi * 1
                    var person = {
                      anchor:anchor,
                      weight:multi
                    }

                      //Perform the add
                    var requesting = store.add(person);

                    requesting.onsuccess = function(e) {
                      }

                    requesting.onerror = function(e) {
                      substring_count = substring_count + 1
                      var db = ev.target.result;
                      var transaction = db.transaction(["customers"],"readwrite");

                      //Ask for the objectStore
                      var store = transaction.objectStore("customers");
                      console.log("Error",e.target.error.name);
                      var myIndex = store.index('anchor');
                      var getRequest = myIndex.get(anchor);

                      getRequest.onsuccess = function() {
                        const data = getRequest.result;
                        data.weight = data.weight + multi

                        const updateTitleRequest = store.put(data);
                        updateTitleRequest.onsuccess = function(e) {
                          substring_count = substring_count - 1
                          if(substring_count < 1) {
                            Result_Output()
                          }
                        }
                      }

                      getRequest.onerror = function() {
                        console.log("get request failed")
                      }
                    }
                  }
                }


               function Response_BreakDown(response) {
                  var page_output = ""
                  var resp = JSON.parse(response);
                  term = resp.user
                  text_response = resp.text

                  x_count = text_response.indexOf('<entry>')

                  temp = resp.text

                  source = resp.source

                  if(source == 'arxiv') {
                    breakdown_arxiv(resp)
                  }

                  if(source == 'DOAJ'){
                    breakdown_DOAJ(resp)
                  }

                  Result_Output()
                }


                function Result_Output(){
                  var requested = indexedDB.open(dbName, 2);

                  requested.onsuccess = function(ev) {
                    var db = ev.target.result;
                    var transaction = db.transaction(["customers"],"readwrite");
                        //Ask for the objectStore
                    var store = transaction.objectStore("customers");
                    var myIndex = store.index('weight',"prev");
                    var getAllRequest = myIndex.getAll();
                    getAllRequest.onsuccess = function() {
                      page_output = ""
                      breakdown_count = breakdown_count + 1
                      list_count = input_list.length * 4
                      if(breakdown_count < list_count) {
                        page_output = page_output + "</p><center> <h2>"+ breakdown_count + " of " + (list_count) + " completed</h2></center>"
                      } else {
                        if (substring_count == 0) {
                          page_output = page_output + "</p><center><h2>Search Completed</h2></center>"
                        }
                      }

                      page_output = page_output + "<table width=100% cellpadding=5>"
                      result_array = getAllRequest.result;
                      result_array = result_array.reverse()

                      out_count = 0

                      for (let i = 0; i < result_array.length; i++) {
                        if(out_count == 0) {page_output = page_output + "<tr>"}
                          page_output = page_output + "<td align=center width=33%>" + result_array[i].anchor  + "</p><font color=red> score: " + result_array[i].weight + "</font></td>"
                          if(page_output == 2){
                            page_output = page_output + "</tr>"
                          }
                          out_count = out_count + 1
                          if(out_count == 3){
                            out_count = 0
                          }
                          if(i == 80){
                            break;
                          }
                        }

                      page_output = page_output + "</table>"
                      document.getElementById("results").innerHTML = ""
                      document.getElementById("results").innerHTML = page_output
                    }
                  }
                }


                var d = new Date();
                var year = d.getFullYear()
                document.getElementById("footer_b").innerHTML = "<center>Copyright Tom Folkes 2006 - " + year + "</center>"

                const dbName = "the_name";

                var req = indexedDB.deleteDatabase(dbName);
                req.onsuccess = function () {
                  //    console.log("Deleted database successfully");
                };
                req.onerror = function () {
                  //    console.log("Couldn't delete database");
                };
                req.onblocked = function () {
                  //    console.log("Couldn't delete database due to the operation being blocked");
                };

                var request = indexedDB.open(dbName, 2);

                request.onerror = function(event) {
                 //	  console.log("db not opened")
                };
                request.onupgradeneeded = function(event) {
                  var db = event.target.result;

                  // Create an objectS and create a key anchor
                  var objectStore = db.createObjectStore("customers", { keyPath: "anchor" });

                  objectStore.createIndex("anchor", "anchor", { unique: true });

                  // Create an index to search customers by name. We may have duplicates
                  // so we can't use a unique index.
                  objectStore.createIndex("weight", "weight", { unique: false });
                }



                input_string = localStorage.last_terms
                input_list = input_string.split(",")

                input_list.forEach(function (item, index) {
                  x = item.indexOf("(")
                  termer = item.substring(0,x)
                  weight = item.substring(x+1, item.length-1)

                  page_counter = 1

                  while (page_counter < 4) {
                    term = termer.trim()
                    page = page_counter
                    term = term + "(" + page + ")"
                    document.getElementById("inputUsername").value = term
                    document.getElementById("inputPassword").value = weight
                    document.getElementById("inputSource").value = 'DOAJ'

                    $.ajax({
                      url: '/signUpUser2',
                      data: $('form').serialize(),
                      type: 'POST',
                      success: (response){
                        Response_BreakDown(response)
                      }
                      error: function(error){
                        console.log(error);
                      }
                    });

                    page_counter = page_counter + 1
                  }
                })


                input_list.forEach(function (item, index) {
                  x = item.indexOf("(")
                  term = item.substring(0,x)
                  weight = item.substring(x+1, item.length-1)
                  user = term.trim()

                  document.getElementById("inputUsername").value = term
                  document.getElementById("inputPassword").value = weight
                  document.getElementById("inputSource").value = 'arxiv'

                  $.ajax({
                    url: '/signUpUser4',
                    data: $('form').serialize(),
                    type: 'POST',
                    success:{
                      Response_BreakDown(response)
                    },
                    error: function(error){
                      console.log(error
                    }
                  });

                })

                function wait(ms) {
                  var start = Date.now(),
                  now = start;
                  while (now - start < ms) {
                    now = Date.now();
                  }
                }


              </script>

                  This form holds the information which is passed to flask
                <form class="form-signin"  role="form">
                  <input type="hidden" name="csrf_token" value="{ csrf_token() }" />
                  <input type="hidden" id="inputUsername" name="username" class="form-control" >
                  <input type="hidden" id="inputPassword" name="password" class="form-control">
                  <input type="hidden" id="inputSource" name="source" class="form-control">
                  <input type="hidden" id="route" name="route" class ="form_control" value="">
                </form>
                  IndexedDB refrence.
                  IndexedDB sandbox.
                  We name the database.
                  We then make sure it is delete because we want a clean slate.  It is way faster to delete the DB than erase all the records.
                const dbName = "the_name";

                var req = indexedDB.deleteDatabase(dbName);
                req.onsuccess = function () {
                //    console.log("Deleted database successfully");
                };

                req.onerror = function () {
                 //    console.log("Couldn't delete database");
                };

                req.onblocked = function () {
                  //    console.log("Couldn't delete database due to the operation being blocked");
                };
                  Open the database.
                var request = indexedDB.open(dbName, 2);

                request.onerror = function(event) {
                  //	  console.log("db not opened")
                };
                  Since the db did not exist it will trigger onupgradeneeded.
                  We create a ObjectStore which is We create a ObjectStore which is loosely a table in SQL speak.
                  See createObjectStore.
                  We create the anchor index which we need to be unique.
                  We create the weight index which is not unique.

                request.onupgradeneeded = function(event) {
                  var db = event.target.result;

                   // Create an objects and create a key anchor
                   var objectStore = db.createObjectStore("customers", { keyPath: "anchor" });

                   objectStore.createIndex("anchor", "anchor", { unique: true });

                   // Create an index to search customers by name. We may have duplicates
                   // so we can't use a unique index.
                   objectStore.createIndex("weight", "weight", { unique: false });
                }
                  Grab the list of terms and their weights.
                  Then put them into input_list as an array.
                input_string = localStorage.last_terms
                input_list = input_string.split(",")
                  For each term. Pull the term and the weight
                input_list.forEach(function (item, index) {
                  x = item.indexOf("(")
                  termer = item.substring(0,x)
                  weight = item.substring(x+1, item.length-1)

                  For each term. We are going to call the flask page which engages DOAJ
                  I put the term and the page call in the same variable. I don't recommend this as a method. It works so I kept going.
                  We are going to use the page signUpUser2. When the information is returned the process is handed to Response_BreakDown.
                  This process is async. I find it interesting that using an sync process with flask the process remains async.
                  while (page_counter < 4) {
                    term = termer.trim()
                    page = page_counter
                    term = term + "(" + page + ")"
                    document.getElementById("inputUsername").value = term
                    document.getElementById("inputPassword").value = weight
                    document.getElementById("inputSource").value = 'DOAJ'

                    $.ajax({
                      url: '/signUpUser2',
                      data: $('form').serialize(),
                      type: 'POST',
                      success: (response){
                        Response_BreakDown(response)
                      }
                      error: function(error){
                        console.log(error);
                      }
                    });
                  This is the same as the above. Just making a request of a diffrent page/API.

                document.getElementById("inputUsername").value = term
                document.getElementById("inputPassword").value = weight
                document.getElementById("inputSource").value = 'arxiv'

                $.ajax({
                  url: '/signUpUser4',
                  data: $('form').serialize(),
                  type: 'POST',
                  success: (response){
                  Response_BreakDown(response)
                }
                  error: function(error){
                    console.log(error)
                  }
                });
 
                  We loop through the arXiv API returning info and turn it into anchors.
                function breakdown_arxiv(resp){

                  while (x_count > -1) {
                    text_response = text_response.substring(x)
                    y = text_response.indexOf('<id>')
                    text_response = text_response.substring(y+4)
                    y = text_response.indexOf('</id>')
                    url = text_response.substring(0,y)

                    y = text_response.indexOf('<title>')
                    text_response = text_response.substring(y+7)
                    y = text_response.indexOf('</title')
                    title = text_response.substring(0,y)

                    anchor = ' <a href="' + url + '" target="_blank">' + title  + '</a>'

                    chipped(anchor, resp.weight)
                    x_count = text_response.indexOf('<entry>')
                  }
                }
                  Same idea as the last subroutine except we are do this for DOAJ data.
                function breakdown_DOAJ(resp) {

                  x = text_response.indexOf('"link":')
                  count = 0
                  while (x > -1) {
                    text_response = text_response.substring(x+9)
                    x = text_response.indexOf('"http')
                    url = text_response.substring(x + 1)
                    x = url.indexOf('"}]')
                    url = url.substring(0,x)

                    x = text_response.indexOf('"title":')
                    text_response = text_response.substring(x+10)
                    x = text_response.indexOf('"},')
                    title = text_response.substring(0,x)
                    x = title.indexOf('",')
                    if(x > -1) {
                      title = title.substring(0,x)
                    }

                    anchor = ' <a href="' + url + '" target="_blank">' + title  + '</a>'

                        //  here we are checking to see if the term and anchor have been entered
                        //  before. This prevents people from putting search terms in multiple
                        //  times
                    chipped(anchor, resp.weight)
                    x = text_response.indexOf('"link":')
                  }
                }
                  This is the crux of the biscuit.
                  Other routines send anchor and weight/score to this routine.
                  we open the db. If that is successful we create the object store "store."
                  We make sure that multi is an integer
                  create a record then add it to the database
                  If it is successful we go on out merry way
                  If fail we assume that we have tired to enter anchor when we already have one in the database
                  Then we get the index for the anchor
                  we add one to the string_count this is how we keep track of the asyn process of finding these records
                  and rewriting them with the updated value for weight
                  We grab the total value of the weights to this point for that anchor.
                  We then overwrite the record. If we have gone through all of the updates, call result_output.
                function chipped(anchor, multi) {
                  var requested = indexedDB.open(dbName, 2);

                  requested.onsuccess = function(ev) {
                    var db = ev.target.result;
                    var transaction = db.transaction(["customers"],"readwrite");
                    //Ask for the objectStore
                    var store = transaction.objectStore("customers");

                    multi = multi * 1
                    var person = {
                      anchor:anchor,
                      weight:multi
                    }

                    //Perform the add
                    var requesting = store.add(person);

                    requesting.onsuccess = function(e) {
                    }

                    requesting.onerror = function(e) {
                      substring_count = substring_count + 1
                      var db = ev.target.result;
                      var transaction = db.transaction(["customers"],"readwrite");

                      //Ask for the objectStore
                      var store = transaction.objectStore("customers");
                      console.log("Error",e.target.error.name);
                      var myIndex = store.index('anchor');
                      var getRequest = myIndex.get(anchor);

                      getRequest.onsuccess = function() {
                        const data = getRequest.result;
                        data.weight = data.weight + multi

                        const updateTitleRequest = store.put(data);
                        updateTitleRequest.onsuccess = function(e) {
                          substring_count = substring_count - 1
                          if(substring_count < 1) {
                            Result_Output()
                          }
                        }
                      }

                      getRequest.onerror = function() {
                        console.log("get request failed")
                      }
                    }
                  }
                }

                  This is pretty simple we just read the header and then figure out which routine to breakdown the data.
                function Response_BreakDown(response) {
                  var page_output = ""
                  var resp = JSON.parse(response);
                  term = resp.user
                  text_response = resp.text

                  x_count = text_response.indexOf('<entry>')

                  temp = resp.text

                  source = resp.source

                  if(source == 'arxiv') {
                    breakdown_arxiv(resp)
                  }

                  if(source == 'DOAJ'){
                    breakdown_DOAJ(resp)
                  }

                  Result_Output()
                }

                  This is the routine which puts the info on the screen.
                  Frankly, the part that manages the search complete does not work very well. This is because the input lags the ability of indexedDB to process data.
                  In addition I am working with asyn processes and I don't know how long the list of anchors is.
                  Open up the database and get a list of index by weight.
                  Initiate the output information.
                  breakdown_count count is the number of passes to write this info out.
                  list_count is 4 times the incoming list of terms. This is because I use it 4 times.
                  Once for arXiv and three times for DOAJ.
                  when we output the anchors we lay them out three across. This is the purpose of tracking page_output.
                   I limit the output to 80 anchors. It is just arbartry..
                function Result_Output(){
                  var requested = indexedDB.open(dbName, 2);

                  requested.onsuccess = function(ev) {
                    var db = ev.target.result;
                    var transaction = db.transaction(["customers"],"readwrite");
                       //Ask for the objectStore
                    var store = transaction.objectStore("customers");
                    var myIndex = store.index('weight',"prev");
                    var getAllRequest = myIndex.getAll();
                    getAllRequest.onsuccess = function() {
                      page_output = ""
                      breakdown_count = breakdown_count + 1
                      list_count = input_list.length * 4
                      if(breakdown_count < list_count) {
                        page_output = page_output + "</p><center> <h2>"+ breakdown_count + " of " + (list_count) + " completed</h2></center>"
                      } else {
                        if (substring_count == 0) {
                          page_output = page_output + "</p><center><h2>Search Completed</h2></center>"
                        }
                      }

                      page_output = page_output + "<table width=100% cellpadding=5>"
                      result_array = getAllRequest.result;
                      result_array = result_array.reverse()

                      out_count = 0

                      for (let i = 0; i < result_array.length; i++) {
                        if(out_count == 0) {page_output = page_output + "<tr>"}
                        page_output = page_output + "<td align=center width=33%>" + result_array[i].anchor  + "</p><font color=red> score: " + result_array[i].weight + "</font></td>"
                        if(page_output == 2){
                          page_output = page_output + "</tr>"
                        }
                        out_count = out_count + 1
                        if(out_count == 3){
                          out_count = 0
                        }
                        if(i == 80){
                          break;
                        }
                      }

                      page_output = page_output + "</table>"
                      document.getElementById("results").innerHTML = ""
                      document.getElementById("results").innerHTML = page_output
                    }
                  }
                }