You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "O. Olson" <ol...@yahoo.it> on 2013/01/18 20:47:22 UTC
Question on Solr Velocity Example
Hi,
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? 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.)
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.
I would appreciate any help on these questions. If the above description is not clear please let me know.
Thank you,
O. O.
Re: Question on Solr Velocity Example
Posted by "O. Olson" <ol...@yahoo.it>.
----- Messaggio originale -----
Da: Erik Hatcher <er...@gmail.com>
A: solr-user@lucene.apache.org; O. Olson <ol...@yahoo.it>
Cc:
Inviato: Venerdì 18 Gennaio 2013 15:20
Oggetto: Re: Question on Solr Velocity Example
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
---------------------
Thank you Erik. On the Page http://wiki.apache.org/solr/VelocityResponseWriter#Velocity_Context if you click on QueryResponse you get a 404 i.e. a link to http://lucene.apache.org/solr/4_0_0/solr-core/org/apache/solr/client/solrj/response/QueryResponse.html is a 404.
Thank you for throwing light on my other questions. Your
responses helped.
Thank you,
O. O.
Re: Question on Solr Velocity Example
Posted by Erik Hatcher <er...@gmail.com>.
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
Re: Question on Solr Velocity Example
Posted by Chris Hostetter <ho...@fucit.org>.
: References: <50...@elyograg.org>
: <BD...@gmail.com>
: <50...@elyograg.org>
: <EB...@gmail.com>
: Message-ID: <13...@web171802.mail.ir2.yahoo.com>
: Subject: Question on Solr Velocity Example
: In-Reply-To: <EB...@gmail.com>
https://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists
When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email. Even if you change the
subject line of your email, other mail headers still track which thread
you replied to and your question is "hidden" in that thread and gets less
attention. It makes following discussions in the mailing list archives
particularly difficult.
-Hoss