Changeset 31384


Ignore:
Timestamp:
2017-02-02T21:41:53+13:00 (4 years ago)
Author:
davidb
Message:

After next phase of development

Location:
other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/INSTALL.sh

    r31383 r31384  
    22
    33/bin/cp *.html *.js *.css ../solr-server-head/solr-webapp/webapp/.
    4 /bin/cp etc/jetty.xml etc/realm.properties ../solr-server-head/etc/.
    54
    6 /bin/cp WEB-INF/*.xml ../solr-server-head/solr-webapp/webapp/WEB-INF/.
    75
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.html

    r31383 r31384  
    22<html><head>
    33<meta http-equiv="content-type" content="text/html; charset=windows-1252">
    4     <!-- base href="https://analytics.hathitrust.org/" -->   
     4
    55        <title>HTRC Extracted Feature Solr Search</title>
    66        <link rel="shortcut icon" href="https://analytics.hathitrust.org/assets/images/favicon.ico">
    77        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    8     <!--
    9         <meta http-equiv="refresh" content="600">
    10 -->
    11             <!-- Bootstrap -->
     8
     9        <!-- Bootstrap -->
    1210        <link href="HTRC_Mashup--Home_files/bootstrap.css" rel="stylesheet" media="screen">
    1311        <link href="HTRC_Mashup--Home_files/main.css" rel="stylesheet" media="screen">
     
    1513        <link href="HTRC_Mashup--Home_files/font-awesome.css" rel="stylesheet">
    1614        <link href="HTRC_Mashup--Home_files/tomorrow.css" rel="stylesheet">
    17 <!--       
    18         <link rel="stylesheet" href="HTRC_Mashup--Home_files/theme.css">
    19     -->
    2015
    2116        <link href="index.css" rel="stylesheet">
     
    167162            <div class="col-md-12">
    168163
    169 
    170 
    171           <h2>Prototype Search</h2>
     164          <h2>Paged-based Extracted Feature Search (Prototype)</h2>
    172165          <form action="htrc-full-ef/select" id="search-form">
    173166        <input type="hidden" id="indent" name="indent" value="on"/>
    174167        <input type="hidden" id="wt" name="wt" value="json"/>
     168        <input type="hidden" id="start" name="start" value="0"/>
     169        <input type="hidden" id="rows" name="rows" value="25"/>
    175170        <input type="text"   id="q" name="q" style="width: 600px;"/>
    176171        <input type="submit" id="search-submit" />
    177172
    178 
     173        <div id="pos-fieldsets">
     174        </div>
     175       
     176<!--
    179177        <fieldset>
    180178          <legend style="margin-bottom: 5px; padding-top: 15px;">
     
    265263          </div>
    266264        </fieldset>
    267 
     265-->
    268266
    269267        <fieldset>
     
    288286
    289287
     288           
     289    <div class="container">
     290      <h4>Admin Resources</h4>
     291      <ul>
     292    <li><a href="admin.html">HTRC-EF Solr Admin UI (log in)</a></li>
     293    <li><a href="luke_lang_mappings.html">Dynamically Generated Language Map (Part-of-Speech, and Other)</a></li>
     294    <li><a href="/solr/htrc-full-ef_shard6_replica1/admin/luke">Luke XML on shard</a></li>
     295      </ul>
     296    </div>
     297
    290298   
    291299        <div class="container">
     
    296304       
    297305        <div id="push"></div>
    298        
    299        
    300        
    301        
    302        
    303         <div>
    304       <a href="solr1.ischool.illinois.edu/solr/htrc-full-ef_shard6_replica1/admin/luke">Luke XML on shard</a>
    305     </div>
    306        
    307        
    308306       
    309307       
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.js

    r31383 r31384  
    11
    2 var langs_with_pos =["da","de","en","nl","pt"];
     2//var langs_with_pos =["da","de","en","nl","pt"];
     3var langs_with_pos =["en","de","pt","da","nl"];
    34var langs_without_pos =["af","ar","bg","bn","cs","el","es","et","fa","fi","fr","he","hi","hr","hu","id","it","ja","kn","ko","lt","lv","mk","ml","mr","ne","no","pa","pl","ro","ru","sk","sl","so","sq","sv","sw","ta","te","th","tl","tr","uk","ur","vi","zh-cn","zh-tw"];
    45
     
    9394}
    9495
    95 $(function() {
    96     $('#en-enabled').click(lang_pos_toggle);
    97     $('#de-enabled').click(lang_pos_toggle);
    98     $('#de-pos-choice *').prop('disabled',true);
    99 
     96function submit_action(event)
     97{
     98    event.preventDefault();
     99
     100    var action = $('#search-form').attr("action");
     101   
     102    var arg_indent = $('#indent').attr('value');
     103    var arg_wt     = $('#wt').attr('value');
     104    var arg_start  = $('#start').attr('value');
     105    var arg_rows   = $('#rows').attr('value');
     106    var q_text     = $('#q').val();
     107   
     108    if (q_text === "") {
     109    alert("No query term entered");
     110    return;
     111    }
     112   
     113    var fields = [];
     114    //var langs_with_pos = [ "da", "de", "en", "nl", "pt", "se" ];
     115    var universal_pos_tags = [ "VERB", "NOUN", "ADJ", "ADV", "ADP", "CONJ", "DET", "NUM", "PRT", "X" ];
     116   
     117    for (var li=0; li<langs_with_pos.length; li++) {
     118    var lang = langs_with_pos[li];
     119    var lang_enabled_id = lang + "-enabled";
     120    var $lang_enabled_cb = $('#'+lang_enabled_id);
     121    if ($lang_enabled_cb.is(':checked')) {
     122        console.log("Extracting POS tags for: " + lang);
     123       
     124        for (var ti=0; ti<universal_pos_tags.length; ti++) {
     125        var tag = universal_pos_tags[ti];
     126        var lang_tag_id = lang+"-"+tag+"-htrctoken-cb";
     127        var $lang_tag_cb = $('#'+lang_tag_id);
     128        if ($lang_tag_cb.is(':checked')) {
     129            var lang_tag_field = "xxxx"+lang+"_"+tag+"_htrctoken";
     130            fields.push(lang_tag_field+":"+q_text);
     131        }
     132        }
     133    }
     134    }
     135
     136    for (var li=0; li<langs_without_pos.length; li++) {
     137    var lang = langs_without_pos[li];
     138    var lang_enabled_id = lang + "-enabled";
     139    var $lang_enabled_cb = $('#'+lang_enabled_id);
     140
     141    if ($lang_enabled_cb.is(':checked')) {
     142        console.log("Adding in non-POS field for: " + lang);
     143        var lang_tag_field = "xxxx"+lang+"_htrctoken";
     144        fields.push(lang_tag_field+":"+q_text);     
     145    }
     146    }
     147
     148    if (fields.length == 0) {
     149    alert("No languages selected");
     150    return;
     151    }
     152   
     153    var arg_q = fields.join(" OR ");
     154   
     155   
     156    // Example search on one of the htrc-full-ef fields is:
     157    //  q=xxxxen_NOUN_htrctoken:farming
     158   
     159    var args = { q: arg_q, indent: arg_indent, wt: arg_wt, start: arg_start, rows: arg_rows };
     160   
     161    $.ajax({
     162    type: 'GET',
     163    url: action,
     164    data: args,
     165    dataType: 'json',
     166    success: show_results,
     167    error: ajax_error
     168    });
     169
     170}
     171
     172function generate_pos_langs()
     173{
     174    var pos_checkbox = [
     175    { pos:"VERB", label:"Verbs",       tooltip:"Verbs (all tenses and modes)" },
     176    { pos:"NOUN", label:"Nouns",       tooltip:"Nouns (common and proper)" },
     177    { pos:"ADJ",  label:"Adjectives",  tooltip: null },
     178    { pos:"ADV",  label:"Adverbs",     tooltip: null },
     179    { pos:"ADP",  label:"Adpositions", tooltip:"Adpositions (prepositions and postpositions)" },
     180    { pos:"CONJ", label:"Conjunctions",tooltip: null },
     181    { pos:"DET",  label:"Determiners", tooltip: null },
     182    { pos:"NUM",  label:"Numbers",     tooltip:"Cardinal numbers" },
     183    { pos:"PRT",  label:"Particles",   tooltip:"Particles or other function words" },
     184    { pos:"X",    label:"Other",       tooltip:"Other words, such as foreign words, typos, abbreviations"}
     185    ];
     186
     187    var $pos_fieldsets = $('#pos-fieldsets');
     188   
     189    for (var li=0; li<langs_with_pos.length; li++) {
     190
     191    var l = langs_with_pos[li];
     192    var lang_full = isoLangs[l].name;
     193    var lang_native_full = isoLangs[l].nativeName;
     194    var opt_title = (lang_full !== lang_native_full) ? 'title="'+lang_native_full+'"' : "";
     195
     196    var opt_enabled = (l == "en") ? 'checked="checked"' : "";
     197   
     198    var legend = "";
     199    legend += '    <legend style="margin-bottom: 5px; padding-top: 15px;">\n';
     200    legend += '      <input type="checkbox" name="'+l+'-enabled" id="'+l+'-enabled" ' + opt_enabled +'/>\n';
     201    legend += '      <span ' + opt_title + '>'+lang_full+':</span>\n';
     202    legend += '    </legend>\n';
     203   
     204
     205    var check_box_list = [];
     206       
     207    for (var pi=0; pi<pos_checkbox.length; pi++) {
     208        var pos_info = pos_checkbox[pi];
     209        var pos = pos_info.pos;
     210        var label = pos_info.label;
     211        var tooltip = pos_info.tooltip;
     212        var opt_tooltip = (tooltip != null) ? 'title="'+tooltip+'"' : "";
     213       
     214        var check_box = "";
     215        check_box += '    <input type="checkbox" name="'+l+'-'+pos+'-htrctoken-cb" id="'+l+'-'+pos+'-htrctoken-cb" checked="checked" />\n';
     216        check_box += '    <label for="'+l+'-'+pos+'-htrctoken-cb" '+opt_tooltip+'>'+label+'</label>\n';
     217
     218        check_box_list.push(check_box);
     219    }
     220   
     221    var fieldset = "";
     222    fieldset += '<fieldset>\n';
     223    fieldset += legend;
     224    fieldset += '  <div id="'+l+'-pos-choice">\n';
     225
     226    var check_box_join = check_box_list.join('&nbsp;');
     227    fieldset += check_box_join;
     228   
     229    fieldset += '  </div>\n';
     230    fieldset += '</fieldset>\n';
     231   
     232    $pos_fieldsets.append(fieldset);
     233    $('#'+l+'-enabled').click(lang_pos_toggle);
     234
     235    if (l == "en") {
     236        $('#en-pos-choice *').prop('disabled',false);
     237    }
     238    else {
     239        $('#'+l+'-pos-choice *').prop('disabled',true);
     240    }
     241    }
     242
     243
     244    //$('#en-enabled').click(lang_pos_toggle);
     245    //$('#de-enabled').click(lang_pos_toggle);
     246    //$('#de-pos-choice *').prop('disabled',true);
     247}
     248
     249function generate_other_langs()
     250{
    100251    // setup other languages
    101252    // for each 'langs_without_pos' generate HTML of the form:
    102253    //    <input type="checkbox" name="fr-enabled" id="fr-enabled" />French
    103254    var $other_langs = $('#other-langs');
     255
    104256    for (var i=0; i<langs_without_pos.length; i++) {
    105257    var lang = langs_without_pos[i];
     
    122274   
    123275    }
    124    
    125 
    126    
    127     $('#search-submit').click(function(event) {
    128     event.preventDefault();
    129 
    130     var action = $('#search-form').attr("action");
    131 
    132     var arg_indent = $('#indent').attr('value');
    133     var arg_wt = $('#wt').attr('value');
    134     var q_text = $('#q').val();
    135 
    136     var fields = [];
    137     var langs_with_pos = [ "da", "de", "en", "nl", "pt", "se" ];
    138     var universal_pos_tags = [ "VERB", "NOUN", "ADJ", "ADV", "ADP", "CONJ", "DET", "NUM", "PRT", "X" ];
    139 
    140     for (var l=0; l<langs_with_pos.length; l++) {
    141         var lang = langs_with_pos[l];
    142         for (var t=0; t<universal_pos_tags.length; t++) {
    143         var tag = universal_pos_tags[t];
    144         var lang_tag_id = lang+"-"+tag+"-htrctoken-cb";
    145         var $lang_tag_cb = $('#'+lang_tag_id);
    146         if ($lang_tag_cb.is(':checked')) {
    147             var lang_tag_field = "xxxx"+lang+"_"+tag+"_htrctoken";
    148         fields.push(lang_tag_field+":"+q_text);
    149         }
    150         }
    151     }
    152    
    153     var arg_q = fields.join(" OR ");
    154 
    155 
    156     // Example search on one of the htrc-full-ef fields is:
    157     //  q=xxxxen_NOUN_htrctoken:farming
    158 
    159     var args = { q: arg_q, indent: arg_indent, wt: arg_wt };
    160 
    161     $.ajax({
    162         type: 'GET',
    163         url: action,
    164         data: args,
    165         dataType: 'json',
    166         success: show_results,
    167         error: ajax_error
    168     });
    169 
    170     });
     276}
     277
     278$(function() {
     279    generate_pos_langs();
     280
     281    generate_other_langs();
     282   
     283    $('#search-submit').click(submit_action);
    171284
    172285});
Note: See TracChangeset for help on using the changeset viewer.