query working, but not in slot.

I have a query that works fine in the Query Debugger, but when I try to use it in a template for a slot query I get the following error: " [reference to query] is badly formed for a url query parameter, which must have the form param=value "

The offending portion in the query seems to be: " WHERE rx:sys_title != ‘index’ "

What could possibly cause this, since it does appear to be a valid query?

what is the full query you are trying to use in your autoslot and are you passing it any values in a binding on the template level? Let me know the full setup of what you are trying to do and I will try it here

Here’s my query statement, and how I’m pulling in the slot. The $slottype and $orderby values are defined by the content type fields, and the $pagepath value is defined in the bindings by using “$user.psoFolders.getParentFolderPath($sys.item.guid)”


#set ($slotquery="SELECT * FROM $slottype WHERE jcr:path LIKE '$pagepath' AND rx:sys_title != 'index' $orderby ")

#initslot("pc_st_container_auto" "template=$slottemplate&query=$slotquery&max_results=$limit")
	#foreach($result in $sys.currentslot.relresults)
		$rx.doc.extractBody($result)
	#end
#endslot("pc_st_container_auto")

Everything works fine until I add in this part of it:

AND rx:sys_title != 'index'

A query constructed that way should work…

Have you tried outputting the resulting query string in a page?

Chris brings up a good point if you output it to the page you may see why this query is failing.

Just a shot in the dark here, but I’m not sure that != works for not equal to in JCR queries. In standard SQL, <> is used for not equal to, so you might give that a shot.

I just looked this up http://docs.jboss.org/modeshape/latest/manuals/reference/html/jcr-query-and-search.html#jcr-sql-queries looks like dtaylor is correct you will need to use <> for your query

To be clear, “!=” was implemented in a patch months ago.

I tested a query constructed as bjames described this morning prior to my earlier post.

Bjames, consider patching to the current level.

That did the trick. Thank you for your responses, and we will apply the latest patch.