Jump to content

Search the Community

Showing results for tags 'sphinx search cakephp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, Need some help to get Sphinx Search working - framework being used is CakePHP. Here's the error when clicking the search form on page (I'll post the class code following the error info debugged from CakePHP ---------------------------- Notice (: Undefined index: Job [APP/Controller/JobsController.php, line 79] Code Context $search = object(SphinxClient) { _host => 'localhost' _port => (int) 9312 _offset => (int) 0 _limit => (int) 20 _mode => (int) 6 _weights => array() _sort => (int) 0 _sortby => '' _min_id => (int) 0 _max_id => (int) 0 _filters => array() _groupby => '' _groupfunc => (int) 0 _groupsort => '@group desc' _groupdistinct => '' _maxmatches => (int) 1000 _cutoff => (int) 0 _retrycount => (int) 0 _retrydelay => (int) 0 _anchor => array() _indexweights => array() _ranker => (int) 0 _rankexpr => '' _maxquerytime => (int) 0 _fieldweights => array() _overrides => array() _select => '*' _error => '' _warning => '' _connerror => false _reqs => array() _mbenc => '' _arrayresult => false _timeout => (int) 0 _path => false _socket => false } JobsController::search() - APP/Controller/JobsController.php, line 79 ReflectionMethod::invokeArgs() - [internal], line ?? Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 486 Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187 Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162 [main] - APP/webroot/index.php, line 109 And here's the snippet of code from 'JobsController.php Q: I see the error stating, 'ReflectionMethod::invokeArgs() - [internal], line ??' but need some guidance on how to isolate the fault and resolve. To add, I have found some syntax issues as well - I'm fixing those but need some guidance on getting Sphinx query up and running based on stated criteria. FYI: (Line 79 starts w/this line of code: $results = $search->query($this->request->data['Job']['keywords'], 'src2'); <?php require('Component/SphinxComponent.php'); App::uses('AppController', 'Controller'); /** * Jobs Controller * * @property Job $Job */ class JobsController extends AppController { /** * Uses * * @var array */ // JobTypeType is *not* a typo below public $uses = array('User', 'Resume', 'JobType', 'FieldType', 'Job', 'JobTypeType', 'JobFieldType', 'UserField', 'UserFieldType', 'EducationLevel', 'CandidateView', 'EmployerProfile'); /** * Helpers * * @var array */ public $helpers = array('Text', 'Js', 'Time', 'Number', 'Func'); /** * Components * * @var array */ public $components = array('Email'); /** * beforeFilter callback * * @return void */ public function beforeFilter() { parent::beforeFilter(); //echo $this->request->here; $this->Auth->allow('recent', 'daily', 'industries', 'search', 'limited', 'view'); } /** * isAuthorized callback * * @return void */ public function isAuthorized($user) { if ($user['Role']['role_name'] == 'Employer') { return true; } else { if ($user['Role']['role_name'] == 'Candidate') { if (in_array($this->action, array('search','togglefavorite'))) { return true; } } if (in_array($this->action, array('view'))) { return true; } } return true; } /** * search method * * Takes full-text Sphinx search results and then filters & paginates * * @return void */ public function search() { if ($this->request->is('post')) { $search = new SphinxClient(); $search->setMatchMode(SPH_MATCH_EXTENDED2); $results = $search->query($this->request->data['Job']['keywords'], 'src2'); if (isset($results['matches'])) { $conditions['Job.id'] = array_keys($results['matches']); } if (isset($this->request->data['Job']['field_types_id'])) { foreach ($this->request->data['Job']['field_types_id'] as $field_type_id) { // $conditions[]['Job.job_field_types LIKE'] = '|%' . $field_type_id . '%|'; $field_type_conditions[]['Job.job_field_types LIKE'] = '%|' . $field_type_id . '|%'; } } if (isset($this->request->data['Job']['job_types_id'])) { foreach ($this->request->data['Job']['job_types_id'] as $job_type_id) { // $conditions[]['Job.job_type_types LIKE'] = '|%' . $job_type_id . '%|'; $job_type_conditions[]['Job.job_type_types LIKE'] = '%|' . $job_type_id . '|%'; } } if (is_numeric($this->request->data['Job']['job_salary_type']) && is_numeric($this->request->data['Job']['minimum_salary']) && is_numeric($this->request->data['Job']['maximum_salary'])) { $conditions['Job.job_salary_type'] = $this->request->data['Job']['job_salary_type']; $conditions['Job.job_salary BETWEEN ? AND ?'] = array( $this->request->data['Job']['minimum_salary'], $this->request->data['Job']['maximum_salary'] ); } if (is_numeric($this->request->data['Job']['minimum_experience'])) { $conditions['Job.minimum_experience >='] = $this->request->data['Job']['minimum_experience']; } if (isset($this->request->data['Job']['education_levels_id'])) { foreach ($this->request->data['Job']['education_levels_id'] as $education_levels_id) { $conditions['OR'][]['Job.education_levels_id'] = $education_levels_id; } } if (isset($this->request->data['Job']['date_posted'])) { switch ($this->request->data['Job']['date_posted']) { // Posted Today case 'today': $conditions['Job.modified BETWEEN ? AND ?'] = array( date('Y-m-d').' 00:00:00', date('Y-m-d').' 23:59:59', ); break; // Posted This Week case 'week': $monday = intval(date('d')) - intval(date('N')) + 1; $conditions['Job.modified BETWEEN ? AND ?'] = array( date('Y-m-').$monday.' 00:00:00', date('Y-m-d H:i:s') ); break; // Posted This Month case 'month': $conditions['Job.modified BETWEEN ? AND ?'] = array( date('Y-m-1').' 00:00:00', date('Y-m-d H:i:s') ); break; // Posted Any case '': $conditions['Job.modified NOT'] = null; break; } } $conditions[]['Job.deleted'] = null; } else { $conditions[]['Job.deleted'] = null; } if (isset($field_type_conditions)) { if (isset($job_type_conditions)) { $final_conditions = array( 'AND' => array( array('OR' => $field_type_conditions), array('OR' => $job_type_conditions), array('AND'=>$conditions) ) ); } else { $final_conditions = array( 'AND' => array( array('OR' => $field_type_conditions), array('AND'=>$conditions) ) ); } } else { if (isset($job_type_conditions)) { $final_conditions = array( 'AND' => array( array('OR' => $job_type_conditions), array('AND'=>$conditions) ) ); } else { $final_conditions = array( 'AND' => array( array('AND'=>$conditions) ) ); } } $this->Job->recursive = 0; $this->paginate = array( 'limit'=>10, 'conditions' => $final_conditions, 'order' => array('Job.modified DESC') ); $jobs = $this->paginate('Job'); $fieldTypes = $this->FieldType->find('list'); $jobTypes = $this->JobType->find('list'); $empRaw = $this->EmployerProfile->find('all', ['fields'=>['users_id','company_name']]); foreach ($empRaw as $emp) { $empList[$emp['EmployerProfile']['users_id']] = $emp['EmployerProfile']['company_name']; } $educationLevels = $this->EducationLevel->find('list'); foreach ($jobs as &$job) { } $this->set('jobs', $jobs); $this->set(compact('fieldTypes', 'jobTypes', 'educationLevels', 'empList', 'final_conditions')); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.