Re: Strings

2015-03-10 Thread Nathan Bubna
It's fine to use String methods on String variables.

The question is whether $params.q is still a String variable after your
change. And for that, you may have to ask the Solr folks...

On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau 
wrote:

> Hello,
>
> I have written a vm template for Solr 4.9 which contains the following
> line:
>
> #set ($temp = $params.q.indexOf("aaa"))
>
> which worked fine until I moved the template to a Solr 5 server.
>
> Is it incorrect to use Java String methods on string variables in Velocity?
>
> Cheers,
>
> Philippe
>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>


Re: Strings

2015-03-10 Thread Philippe de Rochambeau
Hi Nathan,

I have tried this 

#set ($test = "abc"))

#set ($temp = $test.indexOf("a"))

but Solr 5 Velocity doesn't like either.

I will ask the Solr folks, as you've suggested.

Philippe


> Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :
> 
> It's fine to use String methods on String variables.
> 
> The question is whether $params.q is still a String variable after your
> change. And for that, you may have to ask the Solr folks...
> 
> On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau 
> wrote:
> 
>> Hello,
>> 
>> I have written a vm template for Solr 4.9 which contains the following
>> line:
>> 
>> #set ($temp = $params.q.indexOf("aaa"))
>> 
>> which worked fine until I moved the template to a Solr 5 server.
>> 
>> Is it incorrect to use Java String methods on string variables in Velocity?
>> 
>> Cheers,
>> 
>> Philippe
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org
>> 
>> 

-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org



Re: Strings

2015-03-10 Thread Nathan Bubna
When you say "doesn't like either", what do you mean? How can you tell it
isn't working? What output do you get?

On Tue, Mar 10, 2015 at 12:18 PM, Philippe de Rochambeau 
wrote:

> Hi Nathan,
>
> I have tried this
>
> #set ($test = "abc"))
>
> #set ($temp = $test.indexOf("a"))
>
> but Solr 5 Velocity doesn't like either.
>
> I will ask the Solr folks, as you've suggested.
>
> Philippe
>
>
> > Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :
> >
> > It's fine to use String methods on String variables.
> >
> > The question is whether $params.q is still a String variable after your
> > change. And for that, you may have to ask the Solr folks...
> >
> > On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau  >
> > wrote:
> >
> >> Hello,
> >>
> >> I have written a vm template for Solr 4.9 which contains the following
> >> line:
> >>
> >> #set ($temp = $params.q.indexOf("aaa"))
> >>
> >> which worked fine until I moved the template to a Solr 5 server.
> >>
> >> Is it incorrect to use Java String methods on string variables in
> Velocity?
> >>
> >> Cheers,
> >>
> >> Philippe
> >>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> >> For additional commands, e-mail: user-h...@velocity.apache.org
> >>
> >>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>


Re: Strings

2015-03-10 Thread Philippe de Rochambeau
From memory (I'm not currently at the office), Velocity says that it's found an 
"a" where either a comma (?) or a right parenthesis is expected.

If the string within the indexOf method is, say, "ABC", then it will say that 
it's found "ABC" instead of a comma or right parenthesis.

If you want, I can give provide accurate examples tomorrow morning when I am 
back at work.

Philippe

Le 10 mars 2015 à 20:47, Nathan Bubna  a écrit :
> 
> When you say "doesn't like either", what do you mean? How can you tell it
> isn't working? What output do you get?
> 
> On Tue, Mar 10, 2015 at 12:18 PM, Philippe de Rochambeau 
> wrote:
> 
>> Hi Nathan,
>> 
>> I have tried this
>> 
>> #set ($test = "abc"))
>> 
>> #set ($temp = $test.indexOf("a"))
>> 
>> but Solr 5 Velocity doesn't like either.
>> 
>> I will ask the Solr folks, as you've suggested.
>> 
>> Philippe
>> 
>> 
>>> Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :
>>> 
>>> It's fine to use String methods on String variables.
>>> 
>>> The question is whether $params.q is still a String variable after your
>>> change. And for that, you may have to ask the Solr folks...
>>> 
>>> On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau >> 
>>> wrote:
>>> 
 Hello,
 
 I have written a vm template for Solr 4.9 which contains the following
 line:
 
 #set ($temp = $params.q.indexOf("aaa"))
 
 which worked fine until I moved the template to a Solr 5 server.
 
 Is it incorrect to use Java String methods on string variables in
>> Velocity?
 
 Cheers,
 
 Philippe
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
>> 
>> -
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org
>> 
>> 

-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org



Re: Strings

2015-03-10 Thread Barbara Baughman
Does Solr Velocity not appreciate setting a String ($temp) to an int 
(indexOf) data type?


Barbara Baughman
Systems Analyst
Information Security
972-883-2157

On 3/10/15 3:52 PM, Philippe de Rochambeau wrote:

 From memory (I'm not currently at the office), Velocity says that it's found an 
"a" where either a comma (?) or a right parenthesis is expected.

If the string within the indexOf method is, say, "ABC", then it will say that it's found 
"ABC" instead of a comma or right parenthesis.

If you want, I can give provide accurate examples tomorrow morning when I am 
back at work.

Philippe

Le 10 mars 2015 à 20:47, Nathan Bubna  a écrit :

When you say "doesn't like either", what do you mean? How can you tell it
isn't working? What output do you get?

On Tue, Mar 10, 2015 at 12:18 PM, Philippe de Rochambeau 
wrote:


Hi Nathan,

I have tried this

#set ($test = "abc"))

#set ($temp = $test.indexOf("a"))

but Solr 5 Velocity doesn't like either.

I will ask the Solr folks, as you've suggested.

Philippe



Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :

It's fine to use String methods on String variables.

The question is whether $params.q is still a String variable after your
change. And for that, you may have to ask the Solr folks...

On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau 
Hello,

I have written a vm template for Solr 4.9 which contains the following
line:

#set ($temp = $params.q.indexOf("aaa"))

which worked fine until I moved the template to a Solr 5 server.

Is it incorrect to use Java String methods on string variables in

Velocity?

Cheers,

Philippe



-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org

-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org



Re: Strings

2015-03-10 Thread Nathan Bubna
Sorry, i'm not a Solr user, so when you say "it will say that it's found";
it is unclear what you are talking about.  I just wanted to know what
output Velocity is generating when given:

#set( $test = "abc" )
#set( $temp = $test.indexOf('a') )
$temp

I would Velocity to generate output of:

0

Does it do that? If so, then Velocity is working right. If it doesn't, then
you may need to talk to the Solr folks. Perhaps they forked Velocity and
have their own different implementation now...

On Tue, Mar 10, 2015 at 1:52 PM, Philippe de Rochambeau 
wrote:

> From memory (I'm not currently at the office), Velocity says that it's
> found an "a" where either a comma (?) or a right parenthesis is expected.
>
> If the string within the indexOf method is, say, "ABC", then it will say
> that it's found "ABC" instead of a comma or right parenthesis.
>
> If you want, I can give provide accurate examples tomorrow morning when I
> am back at work.
>
> Philippe
>
> Le 10 mars 2015 à 20:47, Nathan Bubna  a écrit :
> >
> > When you say "doesn't like either", what do you mean? How can you tell it
> > isn't working? What output do you get?
> >
> > On Tue, Mar 10, 2015 at 12:18 PM, Philippe de Rochambeau  >
> > wrote:
> >
> >> Hi Nathan,
> >>
> >> I have tried this
> >>
> >> #set ($test = "abc"))
> >>
> >> #set ($temp = $test.indexOf("a"))
> >>
> >> but Solr 5 Velocity doesn't like either.
> >>
> >> I will ask the Solr folks, as you've suggested.
> >>
> >> Philippe
> >>
> >>
> >>> Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :
> >>>
> >>> It's fine to use String methods on String variables.
> >>>
> >>> The question is whether $params.q is still a String variable after your
> >>> change. And for that, you may have to ask the Solr folks...
> >>>
> >>> On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau <
> phi...@free.fr
> >>>
> >>> wrote:
> >>>
>  Hello,
> 
>  I have written a vm template for Solr 4.9 which contains the following
>  line:
> 
>  #set ($temp = $params.q.indexOf("aaa"))
> 
>  which worked fine until I moved the template to a Solr 5 server.
> 
>  Is it incorrect to use Java String methods on string variables in
> >> Velocity?
> 
>  Cheers,
> 
>  Philippe
> 
> 
> 
>  -
>  To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>  For additional commands, e-mail: user-h...@velocity.apache.org
> >>
> >> -
> >> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> >> For additional commands, e-mail: user-h...@velocity.apache.org
> >>
> >>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>


Re: Strings

2015-03-10 Thread Sergiu Dumitriu
`Found "a", expected comma` errors are syntax errors, meaning that
there's another open quote somewhere above the code you pasted that
didn't get closed in the right place.

If you don't have any other code above the snippet you pasted, and that
code used to worn in the previous Solr version, then I'd say Solr does
something fishy, concatenating strings in a bad way.

On 03/10/2015 05:13 PM, Nathan Bubna wrote:
> Sorry, i'm not a Solr user, so when you say "it will say that it's found";
> it is unclear what you are talking about.  I just wanted to know what
> output Velocity is generating when given:
> 
> #set( $test = "abc" )
> #set( $temp = $test.indexOf('a') )
> $temp
> 
> I would Velocity to generate output of:
> 
> 0
> 
> Does it do that? If so, then Velocity is working right. If it doesn't, then
> you may need to talk to the Solr folks. Perhaps they forked Velocity and
> have their own different implementation now...
> 
> On Tue, Mar 10, 2015 at 1:52 PM, Philippe de Rochambeau 
> wrote:
> 
>> From memory (I'm not currently at the office), Velocity says that it's
>> found an "a" where either a comma (?) or a right parenthesis is expected.
>>
>> If the string within the indexOf method is, say, "ABC", then it will say
>> that it's found "ABC" instead of a comma or right parenthesis.
>>
>> If you want, I can give provide accurate examples tomorrow morning when I
>> am back at work.
>>
>> Philippe
>>
>> Le 10 mars 2015 à 20:47, Nathan Bubna  a écrit :
>>>
>>> When you say "doesn't like either", what do you mean? How can you tell it
>>> isn't working? What output do you get?
>>>
>>> On Tue, Mar 10, 2015 at 12:18 PM, Philippe de Rochambeau >>
>>> wrote:
>>>
 Hi Nathan,

 I have tried this

 #set ($test = "abc"))

 #set ($temp = $test.indexOf("a"))

 but Solr 5 Velocity doesn't like either.

 I will ask the Solr folks, as you've suggested.

 Philippe


> Le 10 mars 2015 à 19:27, Nathan Bubna  a écrit :
>
> It's fine to use String methods on String variables.
>
> The question is whether $params.q is still a String variable after your
> change. And for that, you may have to ask the Solr folks...
>
> On Tue, Mar 10, 2015 at 10:56 AM, Philippe de Rochambeau <
>> phi...@free.fr
>
> wrote:
>
>> Hello,
>>
>> I have written a vm template for Solr 4.9 which contains the following
>> line:
>>
>> #set ($temp = $params.q.indexOf("aaa"))
>>
>> which worked fine until I moved the template to a Solr 5 server.
>>
>> Is it incorrect to use Java String methods on string variables in
 Velocity?
>>
>> Cheers,
>>
>> Philippe
>>
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org

 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org


>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org
>>
>>
> 


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

-
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org



Re: Strings being encoded HTML safe.

2006-12-23 Thread Nathan Bubna

What version of Velocity are you using? Are you using any event
handlers or anything?  This is not standard Velocity behavior.  You'll
have to give us some more of your config/impl details.

On 12/23/06, Simon Kittle <[EMAIL PROTECTED]> wrote:

Hey,

I'm having a bit of trouble figuring out some encoding details.  I'm using
Velocity on a site, and I've got a string with some double quote characters
in it: ".

If I send this string to velocity in simply a single variable, say,
$testString, then these quote characters come through completely raw
(they're not encoded into ").

However, if this string is part of a Java object, and I send them to
velocity via the object the " characters are encoded to "

So if I had:

String testString = "\"this string has some \" characters";
testObject.someString = "\"this string has some \" characters";

And I put them into velocity, in the same place in the template:

testString: $testString

testObject.someString: $testObject.someString

Then in the HTML generated I get this:

"this string has some " characters
"this string has some " characters

Is there a reason why this would happen in such a way?  And if so, are there
any docs on this stuff?  I've looked in the user guide but am no more
clueful.  I did browse a few months of mailing list archives but couldn't
find a search function.

Thanks

Si



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]