Guest User

Untitled

a guest
Nov 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. /**
  3. * @author Antoine Hedgecock <antoine@pmg.se>
  4. */
  5.  
  6. /**
  7. * @namespace
  8. */
  9. namespace MCNCore\Sphinx;
  10. use SphinxClient,
  11. MCNCore\Object\QueryInfo,
  12. MCNCore\Pagination\Pagination;
  13.  
  14. /**
  15. * @category
  16. */
  17. trait SearchTrait
  18. {
  19. /**
  20. * @var SphinxClient
  21. */
  22. protected $client;
  23.  
  24. /**
  25. * @param Sphinx $sphinx
  26. */
  27. public function setSphinxClient(SphinxClient $sphinx)
  28. {
  29. $this->client = $sphinx;
  30.  
  31. $this->client->setLimits(0, 6, 1000);
  32. var_dump($this->client->query('@topic hello', 'article'));
  33. var_dump($this->client->getLastWarning());
  34. var_dump($this->client->getLastError());
  35. exit;
  36. }
  37.  
  38. protected function doSphinxSearch($index, $qi)
  39. {
  40. if (is_array($qi) || $qi instanceof \Traversable) {
  41.  
  42. $qi = new QueryInfo($qi);
  43. }
  44.  
  45. $this->processParameters(
  46. $qi->getParameters()
  47. );
  48. }
  49.  
  50. private function processParameters(array $parameters)
  51. {
  52.  
  53. }
  54.  
  55. /**
  56. * @abstract
  57. * @return mixed
  58. */
  59. abstract protected function getRepository();
  60. }
Add Comment
Please, Sign In to add comment