On Jan 18, 2013, at 14:47 , O. Olson wrote:
>             I am new to
> Solr (and Velocity), and have downloaded Solr 4.0 from 
> http://lucene.apache.org/solr/downloads.html.
> I started the example solr, and indexed the XML files in the /exampledocs
> directory. Next, I pointed the browser to: http://localhost:8983/solr/browse 
> and I get the results along with the search and faceted search functionality. 
> I
> am interested in learning how this example works. I hope some of you can help
> me with the following questions:  
>  
> 1.      In
> this example, we seem to be using the Velocity templates in: 
> /example/solr/collection1/conf/velocity.
> The overall page at http://localhost:8983/solr/browse seems to be generated 
> from browse.vm - which seems to include (parse) other
> templates. My question here is that I see things like 
> $response.response.clusters
> – Where can I know what properties the “response” object has, or the 
> “clusters”
> object has?

Great question.  $response is as described here 
<http://wiki.apache.org/solr/VelocityResponseWriter#Velocity_Context>

You can navigate Solr's javadocs (or via IDE and the source code as I do) to 
trace what that object returns and then introspect as you drill in.

I often just add '.class' to something in a template to have it output what 
kind of Java object it is, and work from there, such as 
$response.clusters.class 

> Also there seem to be some methods like display_facet_query() –
> where is this defined. Is there some documentation for this, or some way I can
> find this out? I might need to modify these values, hence my question. (I am
> completely new to Velocity – but I think I get some idea by looking at the
> templates.)

display_facet_query is a macro defined in velocity/VM_global_library.vm, which 
is the default Velocity location to put global macros that all templates can 
see. 

> 2.      In http://localhost:8983/solr/browse page, we have a list of Query 
> Facets. Right now I just see two: ipod and GB?
> How are these values obtained? Do they come from elevate.xml?? Here I see 
> ipod,
> but not GB. 

They come from the definition of the /browse handler (in other words, just 
arbitrary query request parameters but hard-coded for example purposes) as: 

       <str name="facet.query">ipod</str>
       <str name="facet.query">GB</str>

The Velocity templates (facet_queries.vm in this case) dynamically generates 
the link and count display for all facet.query's in the request.

        Erik


Reply via email to