solved jrCore_list search

blindmime
@blindmime
10 years ago
772 posts
Can I get a general guide on what is allowed in the search parameter for jrCore_list?

Is everything one can do in sql OK or are there limits?

Are all wildcards OK? Do I need to escape them a certain way?

Can I do something like: search="audio_credits REGEXP ^project-`$item._item_id`$"?
updated by @blindmime: 09/03/14 10:40:33AM
michael
@michael
10 years ago
7,692 posts
The docs page is here:

"{jrCore_list}"
https://www.jamroom.net/the-jamroom-network/documentation/development/89/jrcore-list

% works. I've not tried REGEXP.

search="audio_credits like project-%"
Should work.

--update--
Looks like 'regexp' is in there. Take a look around line 1300 in the function jrCore_db_search_items()

/modules/jrCore/lib/datastore.php

There's a switch there with all the options available.

--update--
Got the docs updated with the Search Conditions
https://www.jamroom.net/the-jamroom-network/documentation/development/89/jrcore-list#search-conditions
updated by @michael: 07/23/14 03:20:58PM
blindmime
@blindmime
10 years ago
772 posts
Do all the symbols work and do I need to escape anything in any particular way?

Like does search="audio_credits REGEXP ^project-`$item._item_id`$" work?

(^ stands for beginning of line and $ stands for ending of line)

There's a list of symbols here: https://qualysguard.qualys.com/qwebhelp/fo_help/module_pc/policies/regular_expression_symbols.htm
brian
@brian
10 years ago
10,136 posts
This is the page you want to check out:

http://dev.mysql.com/doc/refman/5.1/en/regexp.html#operator_regexp


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
michael
@michael
10 years ago
7,692 posts
Best way to test is to give it a go and see if you get back what you were expecting.

Easiest way to test is to put a new file in your current skin:

/skins/YOUR-SKIN/junk.tpl

and put what your after in there:
{jrCore_list module="jrAudio" search="audio_credits REGEXP ^project-5$"}

And see if it returns what your after. If you think its not working correctly, let us know:

WHAT I EXPECTED:
......

WHAT ACTUALLY HAPPENED:
.....

and we can look at getting it fixed up.
blindmime
@blindmime
10 years ago
772 posts
Michael, I do try things a number of ways, but in this case I wasn't sure on a few things, like how jamroom is intepreting some of the symbols or how jrCore_list might require symbols and patterns being escaped. I twould be nice to have this kind of thing clarified.

That link was helpful, Brian. It helped me solve the issue in a previous thread, I think. This

search="audio_credits REGEXP [[:<:]]project-`$item._item_id`[[:>:]]"

appears to generate a match for only "project-1" (1 being the item id) and not project-12 or project-112, etc.
updated by @blindmime: 07/23/14 09:34:17PM
brian
@brian
10 years ago
10,136 posts
That's good - glad the link could be of help.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
michael
@michael
10 years ago
7,692 posts
blindmime:...I wasn't sure on a few things, like how jamroom is intepreting some of the symbols or how jrCore_list might require symbols and patterns being escaped. I twould be nice to have this kind of thing clarified....

Got any suggestions about how I should write this up in the docs that would be the most useful?
blindmime
@blindmime
10 years ago
772 posts
You might go into how the jr5 search function in jrCore_list can accept mysql search parameters and go into detail with some examples of this. Make special note of any exceptions. Also explain how jrCore_list searches must be escaped to work within the double-quote because it's a little different than a php mysql statement, I think. Link to that page Brian referenced. That will give us a framework from which to explore what's possible.

Tags