lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeetendra Gangele <gangele...@gmail.com>
Subject Re: Need help in velocity search UI
Date Tue, 02 Jun 2015 09:17:04 GMT
Hi Michael

Thanks for your reply. I got this is an macro.

I am trying to modify the facet_fields.vm. how it works is like for each $
field.name, $facet.name it gives the result.

But now what I want is I want user to select multiple facets from fields
and once user hit the filter button which I provided below I need to send
all the select fields with selected facets? how can I do this .
since url_for_facet_filter is executed server side how can I pass all the
selected facets of the fields, you can have a look at the UI below

http://54.146.195.106:8080/solr/collection1/browse


Also below is my facet_fields.vm source code. please help me how can I
selected things to url_for_facet_filter

#**
 *  Display facets based on field values
 *  e.g.: fields specified by &facet.field=
 *#

#if($response.facetFields)
  <h2 #annTitle("Facets generated by adding &facet.field= to the request")>
    Filters
  </h2>
  #foreach($field in $response.facetFields)
    ## Hide facets without value
    #if($field.values.size() > 0)
      <span class="facet-field">$field.name</span>
      <ul>
        #foreach($facet in $field.values)
          <li>
                <span class="showhide">#if($facet.name!=$null)$
facet.name#else<em>missing</em>#end($facet.count)</span>
            <div class="showhidecontainer">
                <select name="$facet.name" class="filter $field.name">
                      <option value="-1" selected>select</option>
                        <option value="1">Yes</option>
                      <option value="0">No</option>
              </select>
            </div>
          </li>
        #end
      </ul>
    #end  ## end if > 0
  #end    ## end for each facet field
#end      ## end if response has facet fields
<input type="button" value="filter" id="filterme"/>

<script>
function filter() {
var topicsYes = [], topicsNo = [], semsYes = [], semsNo = [];
$(".filter").each(function() {
        //decide if its topic or sem
  var filter = $(this);
  var value = filter.val();
  if(filter.is(".topics")) {
        if(value === "1") topicsYes.push(filter.attr("name"));
    if(value === "0") topicsNo.push(filter.attr("name"));
  }
  else if(filter.is(".semTags")) {
    if(value === "1") semsYes.push(filter.attr("name"));
    if(value === "0") semsNo.push(filter.attr("name"));
  }
  else {
        console.log("something wrong");
  }
});
console.log(topicsYes, topicsNo, semsYes, semsNo);
}
$(function() {
        $("#filterme").click(filter);
$(".showhide").click(function() {
         $(this).next().slideToggle();
 });
});
</script>
-


On 2 June 2015 at 14:29, Michał B. . <m.bienkowski@gmail.com> wrote:

> Look at the VM_global_library.vm file.
>
> Regards,
> Michal
>
> 2015-06-02 10:47 GMT+02:00 Jeetendra Gangele <gangele397@gmail.com>:
>
> > Hi All I was trying to modify the "facet_fields.vm" do anybody know where
> > is the location of the function "url_for_facet_filter "?
> >
> > Also where will be log stored ?
> >
>
>
>
> --
> Michał Bieńkowski
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message