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 Jeremy Cunningham <je...@statefarm.com> on 2011/10/18 15:05:18 UTC

tomcat Xsl for query output

I am new to solr and not a web developer.  I am a data warehouse guy trying to use solr for the first time. I am using tomcat and have copied over the example multicore code.  I have modified the out of the box search page to meet my needs and the search works fine.  What I need to do is format my results.  I have seen the examples on how to format my url to get the results to use  example.xsl but this only works on the jetty server.  How do I get this to work on tomcat, especially with the multicore example?

Thanks

Re: Xsl for query output

Posted by Chantal Ackermann <ch...@btelligent.de>.
Hi Jeremy,


The xsl files go into the subdirectory /xslt/ (you have to create that)
in the /conf/ directory of the core that should return the transformed
results.

So, if you have a core /myCore/ that you want to return transformed
results you need to put the example.xsl into:

$SOLR_HOME/myCore/conf/xslt/example.xsl

and in $SOLR_HOME/myCore/conf/solrconfig.xml you add (change the cache
value to whatever appropriate):

<queryResponseWriter name="xslt" class="solr.XSLTResponseWriter">
   <int name="xsltCacheLifetimeSeconds">6000</int>
</queryResponseWriter>

Call this in a query:

http://<mysolrserver>/solr/myCore/select?q=id:<id>&wt=xslt&tr=example.xsl


Chantal


On Fri, 2011-10-14 at 07:22 +0200, Jeremy Cunningham wrote:
> Thanks for the response but I have seen this page and I had a few
> questions.  
> 
> 1.  Since I am using tomcat, I had to move the example directory into the
> tomcat directory structure.  In the multicore, there is no example.xsl.
> Where do I 
> need to put it? Also, how do I send docs for indexing when running solr
> under tomcat?  
> 
> Thanks,
> Jeremy
> 
> On 10/13/11 3:46 PM, "Lance Norskog" <go...@gmail.com> wrote:
> 
> >http://wiki.apache.org/solr/XsltResponseWriter
> >
> >This is for the single-core example. It is easiest to just go to
> >solr/example, run java -jar start.jar, and hit the URL in the above wiki
> >page. Then poke around in solr/example/solr/conf/xslt. There is no
> >solrconfig.xml change needed.
> >
> >It is generally easiest to use the solr/example 'java -jar start.jar'
> >example to test out features. It is easy to break configuration linkages.
> >
> >Lance
> >
> >On Thu, Oct 13, 2011 at 12:42 PM, Jeremy Cunningham <
> >jeremy.cunningham.hul4@statefarm.com> wrote:
> >
> >> I am new to solr and not a web developer.  I am a data warehouse guy
> >>trying
> >> to use solr for the first time.  I am familiar with xsl but I can't
> >>figure
> >> out how to get the example.xsl to be applied to my xml results.  I am
> >> running tomcat and have solr working.  I copied over the solr mulitiple
> >>core
> >> example to the conf directory on my tomcat server. I also added the war
> >>file
> >> and the search is fine.  I can't seem to figure out what I need to add
> >>to
> >> the solrcofig.xml or where ever so that the example.xsl is used.
> >>Basically
> >> can someone tell me where to put the xsl and where to configure its
> >>usage?
> >>
> >> Thanks
> >>
> >
> >
> >
> >-- 
> >Lance Norskog
> >goksron@gmail.com
> 


Re: Xsl for query output

Posted by Jeremy Cunningham <je...@statefarm.com>.
Thanks for the response but I have seen this page and I had a few
questions.  

1.  Since I am using tomcat, I had to move the example directory into the
tomcat directory structure.  In the multicore, there is no example.xsl.
Where do I 
need to put it? Also, how do I send docs for indexing when running solr
under tomcat?  

Thanks,
Jeremy

On 10/13/11 3:46 PM, "Lance Norskog" <go...@gmail.com> wrote:

>http://wiki.apache.org/solr/XsltResponseWriter
>
>This is for the single-core example. It is easiest to just go to
>solr/example, run java -jar start.jar, and hit the URL in the above wiki
>page. Then poke around in solr/example/solr/conf/xslt. There is no
>solrconfig.xml change needed.
>
>It is generally easiest to use the solr/example 'java -jar start.jar'
>example to test out features. It is easy to break configuration linkages.
>
>Lance
>
>On Thu, Oct 13, 2011 at 12:42 PM, Jeremy Cunningham <
>jeremy.cunningham.hul4@statefarm.com> wrote:
>
>> I am new to solr and not a web developer.  I am a data warehouse guy
>>trying
>> to use solr for the first time.  I am familiar with xsl but I can't
>>figure
>> out how to get the example.xsl to be applied to my xml results.  I am
>> running tomcat and have solr working.  I copied over the solr mulitiple
>>core
>> example to the conf directory on my tomcat server. I also added the war
>>file
>> and the search is fine.  I can't seem to figure out what I need to add
>>to
>> the solrcofig.xml or where ever so that the example.xsl is used.
>>Basically
>> can someone tell me where to put the xsl and where to configure its
>>usage?
>>
>> Thanks
>>
>
>
>
>-- 
>Lance Norskog
>goksron@gmail.com


Re: Xsl for query output

Posted by Lance Norskog <go...@gmail.com>.
http://wiki.apache.org/solr/XsltResponseWriter

This is for the single-core example. It is easiest to just go to
solr/example, run java -jar start.jar, and hit the URL in the above wiki
page. Then poke around in solr/example/solr/conf/xslt. There is no
solrconfig.xml change needed.

It is generally easiest to use the solr/example 'java -jar start.jar'
example to test out features. It is easy to break configuration linkages.

Lance

On Thu, Oct 13, 2011 at 12:42 PM, Jeremy Cunningham <
jeremy.cunningham.hul4@statefarm.com> wrote:

> I am new to solr and not a web developer.  I am a data warehouse guy trying
> to use solr for the first time.  I am familiar with xsl but I can't figure
> out how to get the example.xsl to be applied to my xml results.  I am
> running tomcat and have solr working.  I copied over the solr mulitiple core
> example to the conf directory on my tomcat server. I also added the war file
> and the search is fine.  I can't seem to figure out what I need to add to
> the solrcofig.xml or where ever so that the example.xsl is used.  Basically
> can someone tell me where to put the xsl and where to configure its usage?
>
> Thanks
>



-- 
Lance Norskog
goksron@gmail.com

RE: Xsl for query output

Posted by "Jaeger, Jay - DOT" <Ja...@dot.wi.gov>.
It depends upon whether you want Solr to do the XSL processing, or the browser.  After fussing a bit, and doing some reading and thinking, we decided it was best to let the browser do the work, at least in our case.

If the browser is doing the processing, you don't need to modify sorlconfig.xml for that, and where you put it depends a bit on where the HTML page that points to the xsl came from.

What we did was create a separate directory called "search" in the webapp directory (parallel to admin, WEB-INF and the like).  In there we placed three things:  our HTML page, our .css file and our xsl.  (That way, when Solr updates, we know exactly how to handle it).

The HTML page refers to the xsl thusly:

			  <input name="stylesheet" type="hidden">

With a value of

	/solr/search/ourXSLStyleSheet.xsl

(We use javascript to generate the HTML, so it isn't in the tag initially).

We started with a copy of example.xsl and modified it *extensively*.  If you are not a programmer, trying to edit the xsl to produce what you want may be more adventure than you want to tackle.

JRU


-----Original Message-----
From: Jeremy Cunningham [mailto:jeremy.cunningham.hul4@statefarm.com] 
Sent: Thursday, October 13, 2011 2:43 PM
To: solr-user@lucene.apache.org
Subject: Xsl for query output

I am new to solr and not a web developer.  I am a data warehouse guy trying to use solr for the first time.  I am familiar with xsl but I can't figure out how to get the example.xsl to be applied to my xml results.  I am running tomcat and have solr working.  I copied over the solr mulitiple core example to the conf directory on my tomcat server. I also added the war file and the search is fine.  I can't seem to figure out what I need to add to the solrcofig.xml or where ever so that the example.xsl is used.  Basically can someone tell me where to put the xsl and where to configure its usage?

Thanks