Re: Fwd: Trouble with Velocity in SOLR 5.0.0

Sergiu Dumitriu <[email protected]> Wed, 11 Mar 2015 04:52:13 -0400
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
That's a change in the velocity engine, the way nested quotes are
escaped is by doubling them:

#set ($temp0 = $paramsq.replaceAll("""", ""))

Or better:

#set ($temp0 = $paramsq.replaceAll('"', ''))

I guess Solr 5 upgraded the version of Velocity they embed, thus the
regression in your code.

On 03/11/2015 04:46 AM, [email protected] wrote:
> 
> Good morning,
> 
> I have found the cause of the error (see below) in this line:
> 
> #set ($temp0 = $paramsq.replaceAll("\"", ""))
> 
> I replaced \" by \u0022, and the error message vanished.
> 
> #set ($temp0 = $test.replaceAll("\u0022", ""))
> 
> Philippe
> 
> ------------------------------------
> 
> ERROR 500
> Encountered "AND" at richtext_doc.vm[line 65, column 51] Was expecting one of: "," ... ")" ... ... 
> 
> -------------------------------------
> 
> 
> #if ($params.q and $pdf_dir_v and $pdf_year_mon_v and $pdf_day_v and $pdf_name_v)
> 
> 	#set ($paramsq = $params.q)
> 	
> 	#if ($paramsq.length() > 0)
> 	
> 		paramsq = $paramsq
> 	
> 		## Remove double quotes
> 		#set ($temp0 = $paramsq.replaceAll("\"", ""))
> 
> 
> 
> -------------------------------------
> 
> 
> 
> 
> 
> 
> ----- Mail transféré -----
> De: [email protected]
> À: "Velocity Users List" <[email protected]>
> Envoyé: Mardi 10 Mars 2015 16:29:48
> Objet: Re: Trouble with Velocity in SOLR 5.0.0
> 
> Problem solved.
> 
> A query Response Writer was not declared in my solrconfig.xml file.
> 
>  <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
>     <str name="template.base.dir">${velocity.template.base.dir:}</str>
>   </queryResponseWriter>
>   
> 
> 
> 
> ----- Mail original -----
> De: [email protected]
> À: "Velocity Users List" <[email protected]>
> Envoyé: Mardi 10 Mars 2015 14:16:41
> Objet: Trouble with Velocity in SOLR 5.0.0
> 
> Hello,
> 
> I am trying to make Velocity work in SOLR 5.0.0.
> 
> First of all, I have added the following lines to my core's solrconfig.xml file:
> 
> <luceneMatchVersion>5.0.0</luceneMatchVersion>
>   
>   <lib dir="../../../contrib/extraction/lib" regex=".*\.jar" />
>   <lib dir="../../../dist/" regex="solr-cell-\d.*\.jar" />
> 
>   <lib dir="../../../contrib/langid/lib/" regex=".*\.jar" />
>   <lib dir="../../../dist/" regex="solr-langid-\d.*\.jar" />
> 
>   <lib dir="../../../contrib/velocity/lib" regex=".*\.jar" />
>   <lib dir="../../../dist/" regex="solr-velocity-\d.*\.jar" />
> ...
> 
> 
> ... and created a /browse request handler
> 
> 
>  <requestHandler name="/browse" class="solr.SearchHandler">
>      <lst name="defaults">
>        <str name="echoParams">explicit</str>
> 
>        <!-- VelocityResponseWriter settings -->
>        <str name="wt">velocity</str>
>        <str name="v.template">browse</str>
>        <str name="v.layout">layout</str>
>        <str name="title">Archives</str>
> 
>        <!-- Query settings -->
>        <str name="defType">edismax</str>
>      
> I have also copied the 'velocity' directory from a 4.9 core to the 
> 
> /archives/solr-5.0.0/server/solr/mycore1/conf directory  
> 
> as well as the toolbox.xml file.
> 
> 
> The mycore1's conf directory now contains the following files and directories:
> 
> currency.xml  lang  protwords.txt  _rest_managed.json  schema.xml  solrconfig.xml  stopwords.txt  synonyms.txt  toolbox.xml  velocity
> 
> 
> 
> When I type http://myserver.com:8990/solr/mycore1/select?q=*:* in a browser, I get an XML page, not HTML generated by Velocity, as expected.
> 
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">5</int>
> <lst name="params"/>
> </lst>
> <result name="response" numFound="0" start="0" maxScore="0.0"/>
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields">
> <lst name="ymd"/>
> </lst>
> <lst name="facet_dates"/>
> <lst name="facet_ranges"/>
> <lst name="facet_intervals"/>
> </lst>
> <lst name="highlighting"/>
> </response>
> 
> 
> What did I miss?
> 
> Cheers,
> 
> Philippe
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/