solved Proxima Search multiple words issue

amartins
@amartins
4 years ago
48 posts
I was facing an issue searching with 2 words using Proxima Bridge, I decide to check out and I figure this out (using log in include.php):
URL: /api/bridge/shoutcast/search?limit=2000&page=1&search=shoutcast_main_genre eq Easy Listening
Data Parsed:
Array
(
    [search] => Array
        (
            [0] => shoutcast_main_genre = Easy
        )

    [order_by] => Array
        (
            [_item_id] => numerical_desc
        )

    [skip_triggers] => 1
    [ignore_pending] => 1
    [privacy_check] => 
    [limit] => 100
)

Here the search array should be:
[search] => Array
        (
            [0] => shoutcast_main_genre = Easy Listening
        )
Am I right?
updated by @amartins: 25 Dec 2018 06:34:04AM
michael
@michael
4 years ago
7,550 posts
The search system expects 3 things for a search query, separated by space.
part(space)part(space)part
so whatever is being passed into it should break as FIRST PART(SPACE)SECOND PART(SPACE)WHATEVER IS LEFT

Makes me think the 'Listening' is not making it to the variable part that's being inserted into the query.

Try URL encoding it, then rawurlencoding it.
shoutcast_main_genre+eq+Easy+Listening
shoutcast_main_genre%20eq%20Easy%20Listening
amartins
@amartins
4 years ago
48 posts
This is the URL passed
http://wow.mucodes.com/api/bridge/shoutcast/search?limit=2000&page=2&search=shoutcast_main_genre%20eq%20Easy%20Listening

From what I can check,
list($key, $opt, $val) = explode(" ", "shoutcast_main_genre eq Easy Listening")
will result in:
$key = "shoutcast_main_genre"
$opt = "eq"
$val = "Easy"

Meaning that "Listening" is discard.

I've made a workaround for it like this:
···
else {
                //list($key, $opt, $val, $val1) = explode(' ', $v);
                $arr = explode(' ', $v);
                $key = $arr[0];
                $opt = $arr[1];
                switch ($opt) {
                    case 'gt':
                        $opt = '>';
                        break;
                    case 'gte':
                        $opt = '>=';
                        break;
                    case 'lt':
                        $opt = '<';
                        break;
                    case 'lte':
                        $opt = '<=';
                        break;
                    case 'eq':
                        $opt = '=';
                        break;
                    case 'ne':
                        $opt = '!=';
                        break;
                }
                $search = "{$key} {$opt}";
                $size = sizeof($arr);
                for($i=2; $i < $size; $i++){
                   $search .= " " . $arr[$i];
                }
            }

            $_sc['search'][] = $search;
···

updated by @amartins: 24 Sep 2018 10:12:28PM
michael
@michael
4 years ago
7,550 posts
Where are you seeing that, It should be:
list($key, $opt, $val) = explode(' ', $v, 3);
so the 3rd part is all the trailing stuff.

--edit--
I see it, its in jrProximaBridge. Will get that fixed up and out to the marketplace.

Thanks.
updated by @michael: 24 Sep 2018 10:42:33PM
michael
@michael
4 years ago
7,550 posts
jrProximaBridge is updated in the marketplace to 1.2.2
https://www.jamroom.net/proxima/networkmarket/242/proxima-bridge

update and the issue should be fixed.
amartins
@amartins
4 years ago
48 posts
michael:
Where are you seeing that, It should be:
list($key, $opt, $val) = explode(' ', $v, 3);
so the 3rd part is all the trailing stuff.

Now it makes more sense, and a much cleaner solution. I will update it.
Thanks.
michael
@michael
4 years ago
7,550 posts
That update is in the marketplace, so just click to update and you should be good to go.
amartins
@amartins
4 years ago
48 posts
I already did.
Thanks for your help.

Tags