"Fossies" - the Fresh Open Source Software Archive

Member "sphinx-2.2.11-release/test/test_107/test.xml" (19 Jul 2016, 2543 Bytes) of package /linux/www/sphinx-2.2.11-release.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) XML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <?xml version="1.0" encoding="utf-8"?>
    2 <test>
    3 <name>RT: memory vs disk kill-list</name>
    4 <config>
    5 searchd
    6 {
    7 <searchd_settings/>
    8     workers = threads
    9     binlog_path =
   10 }
   11 
   12 index test
   13 {
   14     type    = rt
   15     path    = <data_path/>/testrt123
   16     rt_mem_limit = 128K
   17     rt_attr_uint = group_id
   18     rt_field = title
   19     rt_field = content
   20 }
   21 
   22 indexer
   23 {
   24     mem_limit           = 16M
   25 }
   26 
   27 source dummysrc
   28 {
   29     type            = mysql
   30     <sql_settings/>
   31     sql_query       = SELECT * FROM test_table where id=1
   32 }
   33 
   34 index dummysrcmain
   35 {
   36     source          = dummysrc
   37     path            = <data_path/>/dummysrcmain
   38 }
   39 
   40 </config>
   41 
   42 <db_create>
   43 CREATE TABLE test_table
   44 (
   45     id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
   46     title varchar(255) NOT NULL
   47 );
   48 </db_create>
   49 
   50 <db_drop>
   51 DROP TABLE IF EXISTS test_table;
   52 </db_drop>
   53 
   54 <custom_test><![CDATA[
   55 
   56 global $g_locals, $sd_address, $sd_sphinxql_port;
   57 $results = array();
   58 $sockStr = "$sd_address:$sd_sphinxql_port";
   59 if ($sd_address == "localhost")
   60     $sockStr = "127.0.0.1:$sd_sphinxql_port";
   61 $sock = @mysql_connect (
   62     $sockStr,
   63     $g_locals['db-user'],
   64     $g_locals['db-password'] ,
   65     true );
   66 
   67 if ( $sock === false )
   68 {
   69     $results[] = "error: can't connect to searchd: " . @mysql_errno ( $sock ) . " : " . @mysql_error ( $sock );
   70     return;
   71 }
   72 
   73 $title = "";
   74 $ctx = "";
   75 for ( $i=1; $i<20; $i++ )
   76 {
   77     $title .= " title$i";
   78     $ctx .= " ctx$i";
   79 }
   80 
   81 $inserted = 0;
   82 for ( $i=1; $i<470; $i++ )
   83 {
   84     $group = $i + 5000;
   85     $str = "INSERT INTO test ( id, group_id, title, content ) VALUES ( $i, $group, '$title', '$ctx' )";
   86     $res = @mysql_query ($str, $sock );
   87     if ($res===true)
   88     {
   89         $inserted += mysql_affected_rows($sock);
   90     }   
   91     else
   92     {
   93         $results[] = "error: insert: " . @mysql_errno ( $sock ) . " : " . @mysql_error ( $sock );
   94         return;
   95     }
   96 }
   97 $results[] = "total inserted=$inserted";
   98 
   99 $queries = array ( 1, 50, 450, 469 );
  100 for ( $i=0; $i<count ( $queries ); $i++ )
  101 {
  102     $q = "select * from test where id=$queries[$i]";
  103     $res = @mysql_query ( $q, $sock );
  104     if ($res===true)
  105     {
  106         $results[] = "query $i: total_affected=" . mysql_affected_rows($sock);
  107     }
  108     else if ($res===false)
  109     {
  110         $results[] = "query $i: res=$res";
  111         $results[] = "error: query: " . @mysql_errno ( $sock ) . " : " . @mysql_error ( $sock );
  112         return;
  113     }
  114     else
  115     {
  116         $results[] = "query $i: total_rows=" . @mysql_num_rows($res);
  117         while ($row = @mysql_fetch_array($res, MYSQL_ASSOC))
  118         {
  119             foreach ($row as $key => $value)
  120                 $foo[$key] = $value;
  121             $results[] = $foo;
  122         }   
  123     }
  124 }
  125 
  126 @mysql_close($sock);
  127     
  128 ]]></custom_test>
  129 
  130 </test>