Index: other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.css
===================================================================
--- other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.css	(revision 31522)
+++ other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.css	(revision 31524)
@@ -1,2 +1,6 @@
+.show-hide-lang {
+    display: none;
+}
+
 input:disabled {
     background:#dddddd;
Index: other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.html
===================================================================
--- other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.html	(revision 31522)
+++ other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.html	(revision 31524)
@@ -13,9 +13,11 @@
         <link href="HTRC_Mashup--Home_files/font-awesome.css" rel="stylesheet">
         <link href="HTRC_Mashup--Home_files/tomorrow.css" rel="stylesheet">
-
+	<link href="HTRC_Mashup--Home_files/jquery-ui-lightness-1.12.1/jquery-ui.min.css" rel="stylesheet">
+	
         <link href="index.css" rel="stylesheet">
 	
         <script src="HTRC_Mashup--Home_files/highlight.js"></script>
         <script src="HTRC_Mashup--Home_files/jquery.js"></script>
+	<script src="HTRC_Mashup--Home_files/jquery-ui-lightness-1.12.1/jquery-ui.min.js"></script>
         <script src="HTRC_Mashup--Home_files/stupidtable.js"></script>
         <script src="HTRC_Mashup--Home_files/bootstrap.js"></script>
@@ -162,13 +164,14 @@
             <div class="col-md-12">
 
-	      <h2>Paged-based Extracted Feature Search (Prototype)</h2>
-	      <form action="htrc-full-ef/select" id="search-form">
+	      <h2>Unigram Paged-based Extracted Feature Search (Prototype)</h2>
+	      <form action="htrc-full-ef20/select" id="search-form">
 		<input type="hidden" id="indent" name="indent" value="on"/>
 		<input type="hidden" id="wt" name="wt" value="json"/>
 		<input type="hidden" id="start" name="start" value="0"/>
 		<input type="hidden" id="rows" name="rows" value="20"/>
-		<input type="text"   id="q" name="q" style="width: 600px;"/>
-		<input type="submit" id="search-submit" />
-
+		<input type="text"   class="search-in-progress" id="q" name="q" style="width: 600px;"/>
+		<input type="submit" class="search-in-progress" id="search-submit" />
+		<br><input type="checkbox" id="group-results-by-id" name="group-results-by-vol" value="on">Group by Volume
+		
 		<div id="pos-fieldsets">
 		</div>
@@ -268,5 +271,5 @@
 		</div>
 
-		<fieldset>
+		<fieldset class="show-hide-lang">
 		  <legend style="margin-bottom: 5px; padding-top: 15px;">
 		    Other Languages (without modelled parts-of-speech)
@@ -295,5 +298,8 @@
 	<li><a href="admin.html">HTRC-EF Solr Admin UI (log in)</a></li>
 	<li><a href="luke_lang_mappings.html">Dynamically Generated Language Map (Part-of-Speech, and Other)</a></li>
+	<!--
 	<li><a href="/solr/htrc-full-ef_shard6_replica1/admin/luke">Luke XML on shard</a></li>
+-->
+	<li><a href="/solr/htrc-full-ef20_shard6_replica1/admin/luke">Luke XML on shard</a></li>
       </ul>
     </div>
Index: other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.js
===================================================================
--- other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.js	(revision 31522)
+++ other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/index.js	(revision 31524)
@@ -1,5 +1,5 @@
 
 //var langs_with_pos =["da","de","en","nl","pt"];
-var langs_with_pos =["en","de","pt","da","nl"];
+var langs_with_pos =["en","de","pt","da","nl", "sv"];
 var 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"];
 
@@ -43,4 +43,6 @@
 function show_new_results(delta)
 {
+    $('.search-in-progress').css("cursor","wait");
+    
     store_search_args.start += delta;
         
@@ -55,4 +57,52 @@
 }
 
+
+function generate_item(line,id,id_pages)
+{
+    var css_class = (line%2 == 0) ? 'class="evenline"' : 'class="oddline"';
+    
+    var html_item = "";
+
+    var id_pages_len = id_pages.length;
+    
+    for (var pi=0; pi<id_pages_len; pi++) {
+	var page = id_pages[pi];
+	
+	var seqnum = page - 1;
+	var babel_url = "https://babel.hathitrust.org/cgi/pt?id="+id+";view=1up;seq="+seqnum;
+
+	if (id_pages_len>1) {
+
+	    if (pi==0) {
+		html_item += '<p ' + css_class + '>';
+		html_item += '<span style="font-style: italic;" name="'+id+'"><span style="cursor: progress;">Loading ...</span></span><br>';
+
+		
+		html_item += id + ': <a target="_blank" href="' + babel_url + '">page ' + page + '</a> ';
+	    }
+	    else {
+		html_item += ', <a target="_blank" href="' + babel_url + '">page ' + page + '</a> ';
+		
+		//var result_item = '<a target="_blank" href="' + babel_url + '">' + id + ', page ' + page + '</a>';
+		//result_item += ' <span style="font-style: italic;" name="'+id+'"><span style="cursor: progress;">Loading ...</span></span>';
+		//html_item += '<p ' + css_class + '>'+result_item+'</p>';
+	    }
+	}
+	else {
+	    html_item += '<p ' + css_class + '>';
+	    html_item += ' <span style="font-style: italic;" name="'+id+'"><span style="cursor: progress;">Loading ...</span></span><br>';
+	    html_item += '<a target="_blank" href="' + babel_url + '">' + id + ', page ' + page + '</a>';
+	    html_item += '</p>';
+	}
+	
+    }
+
+    if (id_pages_len>1) {
+	html_item += "</p>";
+    }
+
+    return html_item;
+}
+
 function show_results(jsonData) {
     var response = jsonData.response;
@@ -61,13 +111,16 @@
     var num_docs = docs.length;
 
+    $('.search-in-progress').css("cursor","auto");
+    
     var $search_results = $('#search-results');
+
     if (num_docs>0) {
-	$search_results.html("<p>Results: " + num_found + " volumes/documents matched</p>");
-	var from = parseInt(store_search_args.start)+1;
+	$search_results.html("<p>Results: " + num_found + " pages matched</p>");
+	var from = parseInt(store_search_args.start);
 	var to = from + num_rows;
 	$search_results.append("<p>Showing matches: "+from+"-" + to + "</p>");
     }
     else {
-	$search_results.html("<p>No volumes/documents matched your query</p>");
+	$search_results.html("<p>No pages matched your query</p>");
     }
 
@@ -76,25 +129,49 @@
 
     var htids = [];
-    
-    for (var i=0; i<num_docs; i++) {
+
+    var prev_id = null;
+    var prev_pages = [];
+    
+    var i=0;
+    var line_num = 0;
+    while (i<num_docs) {
+//    for (var i=0; i<num_docs; i++) {
 	var doc = docs[i];
 	var id_and_page = doc.id.split(".page-");
 	var id = id_and_page[0];
-	var page = parseInt(id_and_page[1]);
-
-	
-	var css_class = (i%2 == 0) ? 'class="evenline"' : 'class="oddline"';
-	//var restful_safe_id = id.replace(/\./g,",").replace(/:/g, "+").replace(/\//g, "=");
-	
-	var babel_url = "https://babel.hathitrust.org/cgi/pt?id="+id+";view=1up;seq="+page;
-
-	var result_item = '<a target="_blank" href="' + babel_url + '">' + id + ', page ' + page + '</a>';
-	result_item += ' <span style="font-style: italic;" name="'+id+'"><span style="cursor: progress;">Loading ...</span></span>';
-	$search_results.append('<p ' + css_class + '>'+result_item+'</p>');
+	var seqnum = parseInt(id_and_page[1]);
+	var page = seqnum+1;
+
+	if ((prev_id != null) && (id != prev_id)) {
+	    // time to output previous item
+	    var html_item = generate_item(line_num,prev_id,prev_pages);
+	    $search_results.append(html_item);
+	    line_num++;
+	    prev_pages = [page];
+	}
+	else {
+	    // accumulate pages
+	    prev_pages.push(page)
+	}
+	
+//	var css_class = (i%2 == 0) ? 'class="evenline"' : 'class="oddline"';
+//	//var restful_safe_id = id.replace(/\./g,",").replace(/:/g, "+").replace(/\//g, "=");
+	
+//	var babel_url = "https://babel.hathitrust.org/cgi/pt?id="+id+";view=1up;seq="+seqnum;
+
+//	var result_item = '<a target="_blank" href="' + babel_url + '">' + id + ', page ' + page + '</a>';
+//	result_item += ' <span style="font-style: italic;" name="'+id+'"><span style="cursor: progress;">Loading ...</span></span>';
+//	$search_results.append('<p ' + css_class + '>'+result_item+'</p>');
 
 	htids.push("htid:"+id);
 
-    }
-
+	prev_id = id;
+	i++;
+    }
+    
+    var html_item = generate_item(line_num,prev_id,prev_pages);
+    $search_results.append(html_item);
+
+    
     document.location.href="#search-results-anchor";
     
@@ -129,8 +206,12 @@
 var store_search_action = null;
 
+var group_by_vol_checked = 0;
+
 function submit_action(event)
 {
     event.preventDefault();
 
+    $('.search-in-progress').css("cursor","wait");
+    
     store_search_action = $('#search-form').attr("action");
     
@@ -140,6 +221,10 @@
     var arg_rows   = $('#rows').attr('value');
     var q_text     = $('#q').val();
+
+    group_by_vol_checked = $('#group-results-by-id:checked').length;
+
     
     if (q_text === "") {
+	$('.search-in-progress').css("cursor","auto");
 	alert("No query term entered");
 	return;
@@ -162,5 +247,6 @@
 		var $lang_tag_cb = $('#'+lang_tag_id);
 		if ($lang_tag_cb.is(':checked')) {
-		    var lang_tag_field = "xxxx"+lang+"_"+tag+"_htrctoken";
+		    //var lang_tag_field = "xxxx"+lang+"_"+tag+"_htrctoken";
+		    var lang_tag_field = lang+"_"+tag+"_htrctoken";
 		    fields.push(lang_tag_field+":"+q_text);
 		}
@@ -176,5 +262,6 @@
 	if ($lang_enabled_cb.is(':checked')) {
 	    console.log("Adding in non-POS field for: " + lang);
-	    var lang_tag_field = "xxxx"+lang+"_htrctoken";
+	    //var lang_tag_field = "xxxx"+lang+"_htrctoken";
+	    var lang_tag_field = lang+"_htrctoken";
 	    fields.push(lang_tag_field+":"+q_text);	    
 	}
@@ -190,7 +277,12 @@
     
     // Example search on one of the htrc-full-ef fields is: 
-    //  q=xxxxen_NOUN_htrctoken:farming
+    //  q=en_NOUN_htrctoken:farming
     
     store_search_args = { q: arg_q, indent: arg_indent, wt: arg_wt, start: arg_start, rows: arg_rows };
+
+    if (group_by_vol_checked) {
+	store_search_args.sort="id asc";
+    }
+    
     
     $.ajax({
@@ -255,5 +347,11 @@
 	
 	var fieldset = "";
-	fieldset += '<fieldset>\n';
+	var opt_showhide_class = (li>0) ? 'class="show-hide-lang"' : "";
+
+	if (li==1) {
+	    fieldset += '<button id="show-hide-lang">Show other languages ...</button>';
+	}
+	
+	fieldset += '<fieldset ' + opt_showhide_class + '>\n';
 	fieldset += legend;
 	fieldset += '  <div id="'+l+'-pos-choice">\n';
@@ -280,4 +378,21 @@
     //$('#de-enabled').click(lang_pos_toggle);
     //$('#de-pos-choice *').prop('disabled',true);
+
+    show_hide_lang()
+}
+
+function show_hide_lang()
+{
+    $( "#show-hide-lang" ).click(function(event) {
+	event.preventDefault(); 
+	if($('.show-hide-lang:visible').length) {
+	    $('.show-hide-lang').hide("slide", {direction: "up" } , 1000);
+	    $('#show-hide-lang').html("Show other languages ...");
+	}
+	else {
+	    $('.show-hide-lang').show("slide", {direction: "up" } , 1000);
+	    $('#show-hide-lang').html("Hide other languages ...");
+	}
+    });
 }
 
