Solr
  1. Solr
  2. SOLR-2168

Velocity facet output for facet missing

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Response Writers
    • Labels:
      None

      Description

      If I add fact.missing to the facet params for a field, the Veolcity output has in the facet list:

      $facet.name (9220)

      1. SOLR-2168.patch
        0.7 kB
        Peter Wolanin

        Activity

        Hide
        Peter Wolanin added a comment - - edited

        Attaching a functional (if not elegant) fix - I find the velocity template syntax a little ... annoying

        Show
        Peter Wolanin added a comment - - edited Attaching a functional (if not elegant) fix - I find the velocity template syntax a little ... annoying
        Hide
        Erik Hatcher added a comment -

        I've taken the patch idea and gave it a slight modification. In my effort to learn git, I've committed it to my "facet_missing" branch here: http://github.com/erikhatcher/lucene-solr/commit/70197cca24129141081d83ea422515dc69287e73 (I've still got to figure out how to push this change to Solr's trunk through git)

        I changed the code to so that the #set wasn't needed and also changed the label shown for missing facets to <No $field.name> to have angle brackets to avoid it looking like a regular value. These changes ok with you? (I also cleaned up the formatting of that file slightly)

        Out of curiosity, what's annoying about Velocity syntax? (for example, show me how it'd look in your template language of choice)

        Show
        Erik Hatcher added a comment - I've taken the patch idea and gave it a slight modification. In my effort to learn git, I've committed it to my "facet_missing" branch here: http://github.com/erikhatcher/lucene-solr/commit/70197cca24129141081d83ea422515dc69287e73 (I've still got to figure out how to push this change to Solr's trunk through git) I changed the code to so that the #set wasn't needed and also changed the label shown for missing facets to <No $field.name> to have angle brackets to avoid it looking like a regular value. These changes ok with you? (I also cleaned up the formatting of that file slightly) Out of curiosity, what's annoying about Velocity syntax? (for example, show me how it'd look in your template language of choice)
        Hide
        Erik Hatcher added a comment -

        Also, in the patch I linked to in my previous comment I made it so that the missing facet isn't shown if the count is zero.

        Show
        Erik Hatcher added a comment - Also, in the patch I linked to in my previous comment I made it so that the missing facet isn't shown if the count is zero.
        Hide
        Peter Wolanin added a comment - - edited

        Those all sound like good changes.

        In terms of templating -I'd find something like erb, or PHP, or jsp much easier, and I imagine many more people are failiar with those. So far, I feel like it's hard to understand in velocity how variables and control structures are distinguished from the output, and it's not clear that it's a real template in terms of the way e.g. white space is handled or not. This is especially true in the case of macro output, where is seems like e.g. the carriage returns and spaces I'd naturally include in control structures to make them readable become part of the output.

        The variable handling is also weird, that I need to use #set() for actual assignment?

        In terms of readablilty, loo for example, at this bit:

        <li><a href="#url_for_home#lens&fq=$esc.url(
        

        the &fq= is output in the middle of a series of macro and function calls but nothing visually distinguishes them. Can I define new functions instead of macros? If a macro call could be written as #

        {url_for_home}

        it would provide more visual separation.

        I notice in the patch you have:

        "-${field.name}:[* TO *]"
        

        Looks like the function call can be written like this?

        ${esc.url("-${field.name}:[* TO *]")}
        
        Show
        Peter Wolanin added a comment - - edited Those all sound like good changes. In terms of templating -I'd find something like erb, or PHP, or jsp much easier, and I imagine many more people are failiar with those. So far, I feel like it's hard to understand in velocity how variables and control structures are distinguished from the output, and it's not clear that it's a real template in terms of the way e.g. white space is handled or not. This is especially true in the case of macro output, where is seems like e.g. the carriage returns and spaces I'd naturally include in control structures to make them readable become part of the output. The variable handling is also weird, that I need to use #set() for actual assignment? In terms of readablilty, loo for example, at this bit: <li><a href="#url_for_home#lens&fq=$esc.url( the &fq= is output in the middle of a series of macro and function calls but nothing visually distinguishes them. Can I define new functions instead of macros? If a macro call could be written as # {url_for_home} it would provide more visual separation. I notice in the patch you have: "-${field.name}:[* TO *]" Looks like the function call can be written like this? ${esc.url( "-${field.name}:[* TO *]" )}
        Hide
        Yonik Seeley added a comment -

        In my effort to learn git, I've committed it to my "facet_missing" branch here

        Hmmm, I'm liking this already...
        Nice and easy review of patches (including commenting), and you can get just the patch, or the compete file, or the complete tree.

        Show
        Yonik Seeley added a comment - In my effort to learn git, I've committed it to my "facet_missing" branch here Hmmm, I'm liking this already... Nice and easy review of patches (including commenting), and you can get just the patch, or the compete file, or the complete tree.
        Hide
        Peter Wolanin added a comment -


        If you want to start using git more widely for devlopement (assuming people still post the final patches as attachments here) you might want to set up a canonical mirror some place on github so that everyone uses the same initial tree. We have this for Drupal: http://github.com/drupal/drupal and mirroring out of svn is probably even easier if someone has a server and can just run a script on cron every ~15 min.

        Show
        Peter Wolanin added a comment - If you want to start using git more widely for devlopement (assuming people still post the final patches as attachments here) you might want to set up a canonical mirror some place on github so that everyone uses the same initial tree. We have this for Drupal: http://github.com/drupal/drupal and mirroring out of svn is probably even easier if someone has a server and can just run a script on cron every ~15 min.
        Show
        Yonik Seeley added a comment - http://git.apache.org/ http://github.com/apache/lucene-solr
        Hide
        Peter Wolanin added a comment -

        Did this change to the templates get committed to the actual Solr repo?

        Show
        Peter Wolanin added a comment - Did this change to the templates get committed to the actual Solr repo?
        Hide
        Erik Hatcher added a comment - - edited

        Alas not yet, Peter. Sorry.

        Show
        Erik Hatcher added a comment - - edited Alas not yet, Peter. Sorry.

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Wolanin
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development