You are here

function apachesolr_drupal_subquery in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_drupal_subquery()
  2. 6.3 apachesolr.module \apachesolr_drupal_subquery()

Factory function for query objects.

Parameters

$operator: Whether the subquery should be added to another query as OR or AND

Return value

DrupalSolrQueryInterface|false Subquery or error.

Throws

Exception

2 calls to apachesolr_drupal_subquery()
apachesolr_access_build_subquery in apachesolr_access/apachesolr_access.module
Creates a Solr query for a given user
apachesolr_search_conditions_default in ./apachesolr_search.module

File

./apachesolr.module, line 1671
Integration with the Apache Solr search application.

Code

function apachesolr_drupal_subquery($operator = 'OR') {
  if (!interface_exists('DrupalSolrQueryInterface')) {
    require_once dirname(__FILE__) . '/apachesolr.interface.inc';
  }
  $class_info = variable_get('apachesolr_subquery_class', array(
    'file' => 'Solr_Base_Query',
    'module' => 'apachesolr',
    'class' => 'SolrFilterSubQuery',
  ));
  $class = $class_info['class'];
  if (!class_exists($class_info['class']) && isset($class_info['file']) && isset($class_info['module'])) {
    module_load_include('php', $class_info['module'], $class_info['file']);
  }
  $query = new $class($operator);
  return $query;
}