Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-25309

Solr: Invalid Date String

    XMLWordPrintable

    Details

      Description

      When using a field criterion with a timestamp of zero, a string is generated instead of a integer

      new Criterion\Field('start_date', Op::GT, 0);
      

      leads to

      (my_content_type_start_date_value_dt:{"0" TO *})
      

      which result in an error

      ->response not set: array (
      0 =>
      ...
      'error' =>
      stdClass::__set_state(array(
      'msg' => 'Invalid Date String:\'0\'',
      'code' => 400,
      )),
      ...
      

      Steps to reproduce:

      1. Prepare a test eZ Publish 5.4 instalation, fully updated to 5.4.5;
      2. Install Solr Search Engine Bundle, as described here:

      https://doc.ez.no/display/EZP/Solr+Search+Engine+Bundle

      3. Create a new test bundle, and then create a new test command that uses a field criterion with a timestamp of zero:

      new Criterion\Field('publish_date', Operator::GT, 0);
      

      For reference, please use the attached "SearchCommand.php" command, and adapt namespace etc as needed. The example command works with contents of type "article".

      4. Run the command from the console. The following exception is generated:

      [RuntimeException]                                                                                                                                                          
        ->response not set: array (                                                                                                                                                 
          0 =>                                                                                                                                                                      
          stdClass::__set_state(array(                                                                                                                                              
             'responseHeader' =>                                                                                                                                                    
            stdClass::__set_state(array(                                                                                                                                            
               'status' => 400,                                                                                                                                                     
               'QTime' => 65,                                                                                                                                                       
               'params' =>                                                                                                                                                          
              stdClass::__set_state(array(                                                                                                                                          
                 'shards' => 'localhost:8983/solr/collection1',                                                                                                                     
                 'defType' => 'edismax',                                                                                                                                            
                 'q.alt' => '((type_id:"16") AND (language_code_ms:"eng-GB" OR always_available_b:true) AND (article_publish_date_value_dt:{"0" TO *}))',                           
                 'fl' => '*,score,[shard]',                                                                                                                                         
                 'start' => '0',                                                                                                                                                    
                 'fq' => '((document_type_id:"content") AND (*:* AND ((section_id:"1") OR ((type_id:"27" OR type_id:"35" OR type_id:"37" OR type_id:"26") AND (section_id:"3")) OR  
         (section_id:"7"))) AND (meta_indexed_is_main_translation_b:"true"))',                                                                                                      
                 'sort' => '',                                                                                                                                                      
                 'rows' => '25',                                                                                                                                                    
                 'wt' => 'json',                                                                                                                                                    
              )),                                                                                                                                                                   
            )),                                                                                                                                                                     
             'error' =>                                                                                                                                                             
            stdClass::__set_state(array(                                                                                                                                            
               'msg' => 'Invalid Date String:\'0\'',                                                                                                                                
               'code' => 400,                                                                                                                                                       
            )),                                                                                                                                                                     
          )),                                                                                                                                                                       
          1 =>                                                                                                                                                                      
          array (                                                                                                                                                                   
            'defType' => 'edismax',                                                                                                                                                 
            'q.alt' => '((type_id:"16") AND (language_code_ms:"eng-GB" OR always_available_b:true) AND (article_publish_date_value_dt:{"0" TO *}))',                                
            'fq' => '((document_type_id:"content") AND (*:* AND ((section_id:"1") OR ((type_id:"27" OR type_id:"35" OR type_id:"37" OR type_id:"26") AND (section_id:"3")) OR (sec  
        tion_id:"7"))) AND (meta_indexed_is_main_translation_b:"true"))',                                                                                                           
            'sort' => '',                                                                                                                                                           
            'start' => 0,                                                                                                                                                           
            'rows' => 25,                                                                                                                                                           
            'fl' => '*,score,[shard]',                                                                                                                                              
            'wt' => 'json',                                                                                                                                                         
            'shards' => 'localhost:8983/solr/collection1',                                                                                                                          
          ),                                                                                                                                                                        
        )    
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              kuborgh-hgiesenow Hannes Giesenow
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 30 minutes
                  1h 30m