XSL scripting

2008-06-09 Thread Lance Norskog
 This started out in the num-docs thread, but deserves its own. And a wiki
page.

There is a more complex and general way to get the number of documents in
the index. I run a query against solr and postprocess the output with an XSL
script.

Install this xsl script as home/conf/xslt/numfound.xsl.

xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:output method=text/
xsl:template match=/
xsl:value-of select=response/result/@numFound /
xsl:text#x0A;/xsl:text
/xsl:template
/xsl:stylesheet

Make sure 'curl' is installed, and add numfound.sh, a unix shell script.

SHARD=localhost:8080/solr
QUERY=$1

LINK=http://$SHARD/select?indent=onversion=2.2q=$QUERYstart=0rows=0
fl=*wt=xslttr=numfound.xsl
curl --silent $LINK -H Content-Type:text -X GET

Run it as 
sh numfound.sh *:*
 
How to install the XSLT script is to be found on the Wiki.
Star-colon-star is magic for 'all records'.
 

XSL is appalling garbage.

Cheers!
 



Re: XSL scripting

2008-06-09 Thread Otis Gospodnetic
Lance,

Thanks, want to put it up on the Wiki?


Otis --
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch


- Original Message 
 From: Lance Norskog [EMAIL PROTECTED]
 To: solr-user@lucene.apache.org
 Sent: Monday, June 9, 2008 1:12:35 PM
 Subject: XSL scripting
 
 This started out in the num-docs thread, but deserves its own. And a wiki
 page.
 
 There is a more complex and general way to get the number of documents in
 the index. I run a query against solr and postprocess the output with an XSL
 script.
 
 Install this xsl script as home/conf/xslt/numfound.xsl.
 
 
 xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
 
 
 
 
 
 
 
 Make sure 'curl' is installed, and add numfound.sh, a unix shell script.
 
 SHARD=localhost:8080/solr
 QUERY=$1
 
 LINK=http://$SHARD/select?indent=onversion=2.2q=$QUERYstart=0rows=0
 fl=*wt=xslttr=numfound.xsl
 curl --silent $LINK -H Content-Type:text -X GET
 
 Run it as 
 sh numfound.sh *:*
 
 How to install the XSLT script is to be found on the Wiki.
 Star-colon-star is magic for 'all records'.
 
 
 XSL is appalling garbage.
 
 Cheers!



XSL scripting

2008-06-07 Thread Norskog, Lance
This started out in the num-docs thread, but deserves its own. And a
wiki page.

There is a more complex and general way to get the number documents in
the index. I run a query against solr and postprocess the output with an
XSL script.

Install this xsl script as home/conf/xslt/numfound.xsl.

xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:output method=text/
xsl:template match=/
xsl:value-of select=response/result/@numFound /
xsl:text#x0A;/xsl:text
/xsl:template
/xsl:stylesheet

Make sure 'curl' is installed, and add numfound.sh, a unix shell script.

SHARD=localhost:8080/solr
QUERY=$1

LINK=http://$SHARD/select?indent=onversion=2.2q=$QUERYstart=0rows=0
fl=*wt=xslttr=numfound.xsl
curl --silent $LINK -H Content-Type:text -X GET

Run it as 
sh numfound.sh *:*
 
How to install the XSLT script is to be found on the Wiki.
Star-colon-star is magic for 'all records'.
 

XSL is appalling garbage.

Cheers!