Last active
November 4, 2015 06:20
-
-
Save algotrader-dotcom/6b03095d74851b2e4489 to your computer and use it in GitHub Desktop.
Drupal 7: Apache solr search programtically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create file solr-test.php | |
| <?php | |
| define('DRUPAL_ROOT', '/home/vhosts/domain.com'); | |
| require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
| drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
| $q = 'label:nhan vien kinh doanh '.'AND'.' sm_field_location:ha noi'; | |
| $query = apachesolr_drupal_query(); // Get current solr query object | |
| $query->addParam(q, $q); | |
| $response = apachesolr_do_query($query); // Do search with query | |
| print_r($response); | |
| ?> | |
| References | |
| http://www.paulbooker.co.uk/drupal-developer/code-snippet/solr-query-find-related-nodes-other-content-types-similar-taxonomies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment