Skip to content

Commit

Permalink
Merge pull request #9 from robintaylor/master
Browse files Browse the repository at this point in the history
Add some comments to the Exams Solr client
  • Loading branch information
Robin Taylor committed Mar 6, 2014
2 parents 8bee7d6 + d764619 commit a0023fe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions application/libraries/solr/solr_client_dspace_exams.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,8 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$url .= '&fq=' . $this->solrEscape($value) . '';
}

/*
$ranges = array();
foreach($this->configured_date_filters as $filter_name => $filter) {
array_push($ranges,$this->getDateRanges($filter));
}

*/

if (isset($this->date_field))
{
$dates = $this->getDateRanges($this->date_field, $q, $fq);
Expand All @@ -223,9 +218,6 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$ranges = array();
}

//foreach ($datefqs as $datefq) {
// // $url .= '&fq='.$datefq;
//}

// Set up scope
$url .= '&fq=' . $this->container_field . ':' . $this->container;
Expand Down Expand Up @@ -254,6 +246,7 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$url .= '&spellcheck=true&spellcheck.collate=true&spellcheck.onlyMorePopular=false&spellcheck.count=5';
$url .= '&spellcheck.dictionary=' . $this->dictionary;

// Call Solr!
$solr_xml = file_get_contents($url);
$search_xml = @new SimpleXMLElement($solr_xml);

Expand Down Expand Up @@ -310,7 +303,7 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$data['rows'] = $search_xml->result['numFound'];


// Hard coded until I do something better
// First do the non-date filters
foreach ($this->configured_filters as $filter_name => $filter) {
$facet_xml = $search_xml->xpath("//lst[@name='facet_fields']/lst[@name='" . $filter . "']/int");
$facet['name'] = $filter_name;
Expand Down Expand Up @@ -343,6 +336,7 @@ function simpleSearch($q = '*:*', $offset = 1, $fq = array(), $operator = 'OR',
$facets[] = $facet;
}

// Now do the date filters
foreach ($this->configured_date_filters as $filter_name => $filter) {
// Date.. needs facet query, not field, since
// we're on solr 1.4 and can't do nice easy integer ranges
Expand Down

0 comments on commit a0023fe

Please sign in to comment.