示例#1
0
 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                   $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query  Query to filter the percolator queries which
  *                                                                      are executed.
  * @param  string                                               $type
  * @param  array                                                $params Supports setting additional request body options to the percolate request.
  *                                                                      [ Percolator::EXTRA_FILTER,
  *                                                                      Percolator::EXTRA_QUERY,
  *                                                                      Percolator::EXTRA_SIZE,
  *                                                                      Percolator::EXTRA_TRACK_SCORES,
  *                                                                      Percolator::EXTRA_SORT,
  *                                                                      Percolator::EXTRA_FACETS,
  *                                                                      Percolator::EXTRA_AGGS,
  *                                                                      Percolator::EXTRA_HIGHLIGHT ]
  * @return array                                                With matching registered queries.
  */
 public function matchDoc(Document $doc, $query = null, $type = 'type', $params = array())
 {
     $path = $this->_index->getName() . '/' . $type . '/_percolate';
     $data = array('doc' => $doc->getData());
     $this->_applyAdditionalRequestBodyOptions($params, $data);
     return $this->_percolate($path, $query, $data, $params);
 }
示例#2
0
 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                  $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Not implemented yet
  * @return \Elastica\Response
  */
 public function matchDoc(Document $doc, $query = null)
 {
     $path = $this->_index->getName() . '/type/_percolate';
     $data = array('doc' => $doc->getData());
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }
 public function formUpdateDocument()
 {
     $model = new Document($this->data->id);
     $this->data->object = $model->getData();
     $this->data->save = "@fnbr20/structure/corpus/updateDocument|formUpdateDocument";
     $this->data->close = "!\$('#formUpdateDocument_dialog').dialog('close');";
     $this->data->title = 'Document: ' . $model->getEntry() . '  [' . $model->getName() . ']';
     $this->render();
 }
示例#4
0
 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                   $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Query to filter the percolator queries which
  *                                                                     are executed.
  * @param  string                                               $type
  * @return array With matching registered queries.
  */
 public function matchDoc(Document $doc, $query = null, $type = 'type')
 {
     $path = $this->_index->getName() . '/' . $type . '/_percolate';
     $data = array('doc' => $doc->getData());
     // Add query to filter the percolator queries which are executed.
     if ($query) {
         $query = Query::create($query);
         $data['query'] = $query->getQuery();
     }
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }
 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                  $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Query to filter the data
  * @return \Elastica\Response
  */
 public function matchDoc(Document $doc, $query = null)
 {
     $path = $this->_index->getName() . '/type/_percolate';
     $data = array('doc' => $doc->getData());
     // Add query to filter results after percolation
     if ($query) {
         $query = Query::create($query);
         $data['query'] = $query->getQuery();
     }
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }