Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function renderBody()
 {
     $xml = '<delete>';
     foreach ($this->ids as $id) {
         $xml .= '<id>' . SolrRequest::escapeXml($id) . '</id>';
     }
     foreach ($this->queries as $query) {
         $xml .= '<query>' . SolrRequest::escapeXml($query) . '</query>';
     }
     $xml .= '</delete>';
     return SolrRequest::stripCtrlChars($xml);
 }
Пример #2
0
 /**
  * @param array $params
  */
 public function __construct(array $params = array())
 {
     parent::__construct($params, null);
 }
Пример #3
0
 /**
  * @return string
  */
 public function asXml()
 {
     $xml = '';
     foreach ($this->values as $key => $value) {
         $attributes = '';
         if (!$key && $this->boost > 0.0) {
             $attributes = 'boost="' . (double) $this->boost . '" ';
         }
         if (isset($this->update)) {
             $attributes = 'update="' . SolrRequest::escapeXml($this->update) . '" ';
         }
         $xml .= '<field ' . $attributes . 'name="' . SolrRequest::escapeXml($this->name) . '">';
         $xml .= SolrRequest::escapeXml($value);
         $xml .= '</field>';
     }
     return $xml;
 }
Пример #4
0
 /**
  * Builds an attribute from a class property if it is set.
  *
  * @param string $property
  *
  * @return string
  */
 public function buildAttribute($property)
 {
     $attribute = '';
     if (isset($this->{$property})) {
         $attribute .= ' ' . $property . '="';
         if (is_bool($this->{$property})) {
             $attribute .= $this->{$property} ? 'true' : 'false';
         } else {
             $attribute .= SolrRequest::escapeXml($this->{$property});
         }
         $attribute .= '"';
     }
     return $attribute;
 }