Ticket #304 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Collection searches are buggy

Reported by: Michiel.Schok Owned by: arjen
Priority: critical Milestone: MediaMosa 2.1
Component: Core Version: 2.1.4
Keywords: Cc:
MoSCoW: none Estimated time after impact analysis:
Related to project: none Tested: yes
Accepted: yes Estimated Hours:

Description

We observe some problems when doing collections searches from SURFmedia.

for instance, on a personal collection-page , we provide the 'public' and 'private' collections of a user.

When I list 'all' my collections, there are 29 collections:

[GET] collection?owner_id=SURFNET.michiel

<response>
  <header>
    <item_count>10</item_count>
    <item_count_total>29</item_count_total>
    <item_offset>0</item_offset>
    <request_class>mediamosa_rest_call_collection_search</request_class>
    <request_matched_method>GET</request_matched_method>
    <request_matched_uri>/collection</request_matched_uri>
    <request_process_time>0.0302</request_process_time>
    <request_result>success</request_result>
    <request_result_description></request_result_description>
    <request_result_id>601</request_result_id>
    <request_uri>[GET] collection?owner_id=SURFNET.michiel</request_uri>
    <version>2.1.2.548:d1149b35afd3</version>
    <request_query_count>4</request_query_count>
  </header>
  <items>
    <item id="1">
      <coll_id>4tucmbEBIoYctFNU7WHm0R2T</coll_id>
      <title>Gebarentaal eigen ervaring</title>
      <description></description>
      <app_id>5</app_id>
...

But, when I request only private collections, I get all collection for which 'private=false'...

[GET] collection?owner_id=SURFNET.michiel&amp;private=true

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <header>
    <item_count>10</item_count>
    <item_count_total>28</item_count_total>
    <item_offset>0</item_offset>
    <request_class>mediamosa_rest_call_collection_search</request_class>
    <request_matched_method>GET</request_matched_method>
    <request_matched_uri>/collection</request_matched_uri>
    <request_process_time>0.1003</request_process_time>
    <request_result>success</request_result>
    <request_result_description></request_result_description>
    <request_result_id>601</request_result_id>
    <request_uri>[GET] collection?owner_id=SURFNET.michiel&amp;private=true</request_uri>
    <version>2.1.2.548:d1149b35afd3</version>
    <request_query_count>4</request_query_count>
  </header>
  <items>
    <item id="1">
      <coll_id>4tucmbEBIoYctFNU7WHm0R2T</coll_id>
      <title>Gebarentaal eigen ervaring</title>
      <description></description>
      <app_id>5</app_id>
      <owner_id>SURFNET.michiel</owner_id>
      <group_id>default</group_id>
      <isprivate>FALSE</isprivate>
      <private>FALSE</private>
      <public>TRUE</public>
...

private=false gives the same response.

public=true or public=false gives this response:

[GET] collection?owner_id=SURFNET.michiel&amp;public=true

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <header>
    <item_count>1</item_count>
    <item_count_total>1</item_count_total>
    <item_offset>0</item_offset>
    <request_class>mediamosa_rest_call_collection_search</request_class>
    <request_matched_method>GET</request_matched_method>
    <request_matched_uri>/collection</request_matched_uri>
    <request_process_time>0.0631</request_process_time>
    <request_result>success</request_result>
    <request_result_description></request_result_description>
    <request_result_id>601</request_result_id>
    <request_uri>[GET] collection?owner_id=SURFNET.michiel&amp;public=true</request_uri>
    <version>2.1.2.548:d1149b35afd3</version>
    <request_query_count>4</request_query_count>
  </header>
  <items>
    <item id="1">
      <coll_id>852YPHq7H2TaYNcfpetZWbMW</coll_id>
      <title>private/nietrecent</title>
      <description>collectieomschrijving</description>
      <app_id>5</app_id>
      <owner_id>SURFNET.michiel</owner_id>
      <group_id>default</group_id>
      <isprivate>TRUE</isprivate>
      <private>TRUE</private>
      <public>FALSE</public>
      <category>FALSE</category>
      <created>2009-06-17 11:28:26</created>
      <changed>2010-05-17 15:06:27</changed>
      <is_unappropriate>FALSE</is_unappropriate>
      <public_assign>FALSE</public_assign>
      <numofvideos>1</numofvideos>
    </item>
  </items>
</response>

It seems like mediamosa doesn't look at the boolean value, but instead always uses '=FALSE'...

Change History

Changed 3 years ago by forgacs

  • owner set to arjen
  • status changed from new to assigned

It is fixed. It is on my local repository.

I changed this part of code:

diff -r ea6d57732792 sites/all/modules/mediamosa/core/cql/mediamosa_core_cql.inc
@@ -99,7 +99,7 @@
 
       case mediamosa_type::TYPE_SEARCH_BOOL:
         foreach ($a_value as $value) {
-          $a_or[] = $name . ' == "^' . addslashes($value) . '^"';
+          $a_or[] = $name . ' == "' . addslashes($value) . '"';
         }
         break;

Because it produced "^true^", and it wasn't compatible with this code (that expected "true"):

File: sites/all/modules/mediamosa/core/cql/mediamosa_core_cql.inc
Line: 649

      case mediamosa_type::TYPE_BOOL:
        $str_search_term = (mediamosa_unicode::strtolower($str_search_term) == "true" ? "TRUE" : "FALSE");
        $str_quotes = '\'';
        $str_like = '=';
        $str_relation = '==';
        break;

Please, review it.

Changed 3 years ago by MC-arjen

  • status changed from assigned to closed
  • version set to 2.1.4
  • resolution set to fixed

Committed to 2.1.4

Changed 3 years ago by Michiel.Schok

  • status changed from closed to reopened
  • resolution fixed deleted

I see a problem on the horizon.. Hope it is easy to fix.

Three cases that were working previously, and now result in an SURFmedia crash (unexpected error-page):

1. A standard collection search:

<request_result_description>MediaMosa - CQL returned an error; Syntax error at position 39, expecting boolean, operator or sortby.</request_result_description>
<request_result_id>1033</request_result_id>
<request_uri>[GET] collection?public=true&amp;mode=list&amp;title=test&amp;order_by=created&amp;order_direction=asc&amp;operator=and&amp;is_app_admin=FALSE&amp;limit=10&amp;offset=0&amp;aut_domain=surfnet.nl&amp;app_id=5</request_uri>
<version>2.1.4.594:55f14ee154f5</version>

2. Open 'My Media' when logged in:

<request_result_description>MediaMosa - CQL returned an error; Syntax error at position 53, expecting boolean, operator or sortby.</request_result_description>
<request_result_id>1033</request_result_id>
<request_uri>[GET] collection?public=true&amp;owner_id=SURFNET.michiel&amp;order_by=title&amp;operator=and&amp;is_app_admin=FALSE&amp;limit=100&amp;offset=0&amp;aut_user=SURFNET.michiel&amp;user_id=SURFNET.michiel&amp;aut_group_id[0]=nl:surfnet:diensten:team_1&amp;aut_group_id[1]=nl:surfnet:diensten:surfteams_testteam&amp;aut_group_id[2]=nl:surfnet:diensten:team_2&amp;aut_group_id[3]=nl:surfnet:diensten:testomgeving_surfteams&amp;aut_realm=Michiel.Schok@surfnet.nl&amp;aut_domain=xposeyourtalent.nl&amp;app_id=5</request_uri>

3. Using upload in SURFmedia (also fetches collections), same error as (2).

Sorry...

Changed 3 years ago by robert

Problem reproduced and fixed, in 2.1.4 build 606 is currently being deployed to acc servers.

Changed 3 years ago by Michiel.Schok

  • tested changed from no to yes
  • accepted changed from no to yes

OK, build 606 is OK for this issue.
All three problems mentioned above are now solved, and SURFmedia is humming along with the collections.

Changed 3 years ago by robert

  • status changed from reopened to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.