You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2015/06/05 17:07:11 UTC

svn commit: r1683779 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/contrib/ solr/contrib/velocity/src/resources/ solr/contrib/velocity/src/resources/velocity/ solr/example/ solr/example/files/conf/ solr/example/files/conf/velocity/

Author: ehatcher
Date: Fri Jun  5 15:07:11 2015
New Revision: 1683779

URL: http://svn.apache.org/r1683779
Log:
Add as-you-type instant search to example/files /browse (merged from trunk r1683778)

Added:
    lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/results.vm
      - copied unchanged from r1683778, lucene/dev/trunk/solr/example/files/conf/velocity/results.vm
Removed:
    lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/velocity/macros.vm
Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/contrib/   (props changed)
    lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/_macros.vm
    lucene/dev/branches/branch_5x/solr/example/   (props changed)
    lucene/dev/branches/branch_5x/solr/example/files/conf/params.json
    lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/browse.vm
    lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/head.vm
    lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/macros.vm

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Fri Jun  5 15:07:11 2015
@@ -84,6 +84,9 @@ Other Changes
   This is no longer supported by the underlying Lucene locking
   framework.  (Uwe Schindler, Mike McCandless, Robert Muir)
 
+* SOLR-3719: Add as-you-type "instant search" to example/files /browse.
+  (Esther Quansah, ehatcher)
+
 ==================  5.2.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

Modified: lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/_macros.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/_macros.vm?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/_macros.vm (original)
+++ lucene/dev/branches/branch_5x/solr/contrib/velocity/src/resources/_macros.vm Fri Jun  5 15:07:11 2015
@@ -30,3 +30,41 @@
 #macro(url_for_facet_date_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
 
 #macro(url_for_facet_range_filter $field $value)#url_for_home#lens&fq=$esc.url($field):$esc.url($value)#end
+
+# TODO: make this parameterized fully, no context sensitivity
+#macro(field $f)
+  #if($response.response.highlighting.get($docId).get($f).get(0))
+    #set($pad = "")
+      #foreach($v in $response.response.highlighting.get($docId).get($f))
+        $pad$v##  #TODO: $esc.html() or maybe make that optional?
+        #set($pad = " ... ")
+      #end
+  #else
+    #foreach($v in $doc.getFieldValues($f))$esc.html($v)#end
+  #end
+#end
+
+#macro(link_to_previous_page)
+  #if($page.current_page_number > 1)
+    #set($prev_start = $page.start - $page.results_per_page)
+    <a class="prev-page" href="#url_for_start($prev_start)">$resource.previous</a>
+  #end
+#end
+
+#macro(link_to_next_page)
+  #if($page.current_page_number < $page.page_count)
+    #set($next_start = $page.start + $page.results_per_page)
+    <a class="next-page" href="#url_for_start($next_start)">$resource.next</a>
+  #end
+#end
+
+#macro(link_to_page $page_number $text)
+  #if($page_number == $page.current_page_number)
+    $text
+  #else
+    #if($page_number <= $page.page_count)
+      #set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
+      <a class="page" href="#url_for_start($page_start)">$text</a>
+    #end
+  #end
+#end

Modified: lucene/dev/branches/branch_5x/solr/example/files/conf/params.json
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/files/conf/params.json?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/files/conf/params.json (original)
+++ lucene/dev/branches/branch_5x/solr/example/files/conf/params.json Fri Jun  5 15:07:11 2015
@@ -8,6 +8,7 @@
   "facets":{
     "facet":"on",
     "facet.mincount":"1",
+    "f.doc_type.facet.mincount":"0",
     "facet.field":["text_shingles","{!ex=type}doc_type"],
     "f.text_shingles.facet.limit":10,
     "facet.query":"{!ex=type key=all_types}*:*",

Modified: lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/browse.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/browse.vm?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/browse.vm (original)
+++ lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/browse.vm Fri Jun  5 15:07:11 2015
@@ -27,25 +27,6 @@
 
 
 <div id="browse_results">
-  <div id="facets">
-    #parse("facets.vm")
-  </div>
-
-
-  <div id="results_list">
-    <div class="pagination">
-      <span class="results-found">$page.results_found</span> $resource.results_found_in.insert(${response.responseHeader.QTime})
-      $resource.page_of.insert($page.current_page_number,$page.page_count)
-    </div>
-
-    #parse("results_list.vm")
-
-    <div class="pagination">
-      #link_to_previous_page
-      <span class="results-found">$page.results_found</span> $resource.results_found.
-      $resource.page_of.insert($page.current_page_number,$page.page_count)
-      #link_to_next_page
-    </div>
-  </div>
+  #parse("results.vm")
 </div>
 

Modified: lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/head.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/head.vm?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/head.vm (original)
+++ lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/head.vm Fri Jun  5 15:07:11 2015
@@ -13,15 +13,23 @@
 
 <script type="text/javascript">
   $(document).ready(function(){
+
     $("#tagcloud").tx3TagCloud({
       multiplier: 5
     });
 
+    $('.menu').dropit();
 
-     $('.menu').dropit();
-  });
-
+    $( document ).ajaxComplete(function() {
+        $("#tagcloud").tx3TagCloud({
+        multiplier: 5
+        });
+    });
 
+    $('\#q').keyup(function() {
+      $('#browse_results').load('#{url_for_home}?#lensNoQ&v.layout.enabled=false&v.template=results&q='+encodeURI($('\#q').val()));
+    });
+  });
 </script>
 
 <style>
@@ -219,4 +227,7 @@
   margin: 0;
   }
   .dropit .dropit-open .dropit-submenu { display: block; }
+
+
+  
 </style>
\ No newline at end of file

Modified: lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/macros.vm
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/macros.vm?rev=1683779&r1=1683778&r2=1683779&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/macros.vm (original)
+++ lucene/dev/branches/branch_5x/solr/example/files/conf/velocity/macros.vm Fri Jun  5 15:07:11 2015
@@ -1,50 +1,13 @@
-#macro(lensNoQ)?#if($list.size($response.responseHeader.params.getAll("fq")) > 0)&#fqs($response.responseHeader.params.getAll("fq"))#end#sort($request.params.getParams('sort'))#end
+#macro(lensFilterSortOnly)?#if($list.size($response.responseHeader.params.getAll("fq")) > 0)&#fqs($response.responseHeader.params.getAll("fq"))#end#sort($request.params.getParams('sort'))#end
+#macro(lensNoQ)#lensFilterSortOnly&type=#current_type#if("#current_locale"!="")&locale=#current_locale#end#end
+#macro(lensNoType)#lensFilterSortOnly#q#if("#current_locale"!="")&locale=#current_locale#end#end
+#macro(lensNoLocale)#lensFilterSortOnly#q&type=#current_type#end
 
 ## lens modified for example/files - to use fq from responseHeader rather than request, and #debug removed too as it is built into browse params now, also added type to lens
-#macro(lens)#lensNoQ#q&type=#current_type#if("#current_locale"!="")&locale=#current_locale#end#end
-
-
-# TODO: make this parameterized fully, no context sensitivity
-#macro(field $f)
-  #if($response.response.highlighting.get($docId).get($f).get(0))
-    #set($pad = "")
-    #foreach($v in $response.response.highlighting.get($docId).get($f))
-$pad$v##  #TODO: $esc.html() or maybe make that optional?
-      #set($pad = " ... ")
-    #end
-  #else
-    #foreach($v in $doc.getFieldValues($f))$esc.html($v)
-    #end
-  #end
-#end
-
-#macro(link_to_previous_page)
-  #if($page.current_page_number > 1)
-    #set($prev_start = $page.start - $page.results_per_page)
-    <a class="prev-page" href="#url_for_start($prev_start)">$resource.previous</a>
-  #end
-#end
-
-#macro(link_to_next_page)
-  #if($page.current_page_number < $page.page_count)
-    #set($next_start = $page.start + $page.results_per_page)
-    <a class="next-page" href="#url_for_start($next_start)">$resource.next</a>
-  #end
-#end
-
-#macro(link_to_page $page_number $text)
-  #if($page_number == $page.current_page_number)
-    $text
-  #else
-    #if($page_number <= $page.page_count)
-      #set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
-      <a class="page" href="#url_for_start($page_start)">$text</a>
-    #end
-  #end
-#end
+#macro(lens)#lensNoQ#q#end
 
 ## Macros defined custom for the "files" example
-#macro(url_for_type $type)#url_for_home#lensNoQ#q&type=$type#if("#current_locale"!="")&locale=#current_locale#end#end
+#macro(url_for_type $type)#url_for_home#lensNoType&type=$type#end
 #macro(current_type)#if($response.responseHeader.params.type)${response.responseHeader.params.type}#{else}all#end#end
-#macro(url_for_locale $locale)#url_for_home#lensNoQ#q&type=#current_type#if($locale!="")&locale=$locale#end#end
+#macro(url_for_locale $locale)#url_for_home#lensNoLocale#if($locale!="")&locale=$locale#end&start=$page.start#end
 #macro(current_locale)$!{response.responseHeader.params.locale}#end