Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Relations and Result Grouping Support #3

Open
wants to merge 91 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
ec90c3a
Code style fixes.
Oct 1, 2010
731108b
It enables and installs on d7 now at least.
Oct 1, 2010
305c722
render element fixes.
Oct 1, 2010
a1fcb6a
seems like i missed some of the conversion by not converting .inc files.
Oct 1, 2010
2be8202
theme fixes, and more important menu fixes. the path where the pages …
Oct 1, 2010
c2d1743
trying to figure out the insanity that is the new tableselect element.
Oct 2, 2010
febc56f
the base forms work now, sort of.
Oct 4, 2010
a3707f2
got all the forms displaying, but not working yet.
Oct 4, 2010
7b60214
got stuff mostly working , i think. but ran into the field issues.
Oct 6, 2010
04e55dd
some missing fixes
Oct 10, 2010
cb5dba9
db api updates for the backend functions.
Oct 10, 2010
999dc06
think i have the sphinx backend working. it's generating config files…
Oct 11, 2010
689e7ab
environment form displays now.
Oct 11, 2010
7ffb5c3
think i got the configs to work, but i needed to stop using arguments…
Oct 11, 2010
8f08d27
make the menus a little bit nicer.
Oct 11, 2010
769958d
css fixes, and made the tabledrag and popup editing on environment pa…
Oct 11, 2010
154b73a
got the facet block mostly working. and a whole mess of other things …
Oct 11, 2010
41cbae4
got the facet block mostly working. fighting _HARD_ with dbtng now.
Oct 12, 2010
5f670b2
got sorting and facets working.
Oct 12, 2010
30c5c4f
some more random fixes.
Oct 12, 2010
b5400d2
some small updates regarding facets and also solr.
Oct 12, 2010
da1c2ad
some cleanup
Oct 13, 2010
323b0b2
found an annoying bug because i was defaulting a field incorrectly. grrr
Oct 13, 2010
777be44
better defaults.
Oct 13, 2010
c4ebd52
return empty correctly when no results were returned.
Oct 13, 2010
1b6051c
Merge.
Oct 21, 2010
e04213d
Fix for PHP notice.
Oct 21, 2010
591f901
Update table name from term_data to taxonomy_term_data.
Oct 21, 2010
e651686
Update mva taxonomy view generation.
Oct 21, 2010
c7e5140
Fix vocab loading for term facet plugin.
Oct 21, 2010
b2858ed
Whitespace.
Oct 21, 2010
5739079
Monstrous hack to workaround PDO's inability to provide the literal q…
Oct 21, 2010
4c21a40
Reduce differences between master and drupal-7--1 branch where possible.
Oct 21, 2010
ba2a88b
Update AJAX handling for datasource form.
Oct 21, 2010
ec962ac
Selective exclusion of field API metadata columns.
Oct 22, 2010
04e5871
Disable AJAX for the time being.
Oct 22, 2010
a9d2514
Properly limit MVA query fields
Oct 25, 2010
eb49aca
Handle lazy add_where calls where no operator is specified.
Oct 25, 2010
d05ad39
Use taxonomy_index rather than taxonomy_term_data for taxonomy MVA.
Oct 25, 2010
960c3a0
Strtoupper the .
Oct 25, 2010
7341493
Fix for PHP notice.
Oct 25, 2010
af7f368
add cron integration
webflo Oct 25, 2010
b6a983e
Update Searchlight & Views AJAX integration.
Oct 27, 2010
437623a
view statement modified
lbochsler Nov 9, 2010
80a61e9
Result grouping in Solr, fix field alias for MVA
lbochsler Nov 26, 2010
eb92caf
make sure existing options are kept when saving datasource
lbochsler Nov 26, 2010
c2d6a84
Allow getting all multivalues for field list
lbochsler Nov 26, 2010
9fcdacd
Relation-Tests, Joins node-product
lbochsler Nov 29, 2010
a65f133
Cleanout
lbochsler Nov 29, 2010
6494ce5
Initial checkin for relation support.
das-peter Nov 29, 2010
ac142c2
Merge remote branch 'remotes/fork/master'
das-peter Nov 29, 2010
a08474d
Cleanup & add labels for relations
das-peter Nov 30, 2010
8d142df
Changed naming of fields.
das-peter Nov 30, 2010
7a5a27f
Datatypes extended
lbochsler Nov 30, 2010
93b4e55
Try to fix some of the naming issues....
das-peter Nov 30, 2010
2d72a37
More restrained type check in placeholder replacement.
miccolis Nov 30, 2010
7d20902
Adding options parameter to query plugin init.
Dec 1, 2010
e46d38f
Properly set the distinct option on built query.
Dec 1, 2010
76eb66c
Add sort option for facets.
Dec 1, 2010
136cfa8
Don't allow date facet to be sorted.
Dec 1, 2010
d00b961
Fix for Views debug message when datasource field refers to additiona…
Dec 2, 2010
36f8530
Fix for exposed input forms not triggering AJAX render from searchlight.
Dec 2, 2010
7f201cb
Fix for delta TTL.
Dec 3, 2010
678f1f9
Fixes for TTL, field matching.
Dec 3, 2010
95df669
Several notices, aliases fixes
lbochsler Dec 6, 2010
a2d0e3f
view statement modified
lbochsler Nov 9, 2010
91bd20a
Merge latest upstream version
lbochsler Dec 6, 2010
6afb2bd
Remove term hierarchy handling for now and use more efficient term lo…
Dec 6, 2010
2c4a277
Value fields added in datasource, datatype int->intval in backend
lbochsler Dec 7, 2010
a12cb46
Support IS NOT NULL operator.
Dec 7, 2010
267c76b
Some code cleanup
lbochsler Dec 7, 2010
2d9121d
Allow facet URL handler to actually render a link.
Dec 8, 2010
71f8f3b
Loose check for ajax handler.
Dec 8, 2010
da36717
Fix sortCount uasort.
Dec 9, 2010
83eb1fd
Allow datatype detection by handler
lbochsler Dec 16, 2010
353f5c5
Check for empty result
lbochsler Dec 17, 2010
39d747f
By default, new facets are disabled. Exclude disabled facets from exp…
Dec 17, 2010
ac8002c
Support datestamp fields as timestamps.
Dec 17, 2010
d814bdc
Ensure that facet conditions do not conflict with existing conditions…
Dec 17, 2010
b98c70e
Check plain at last stage of output.
Dec 17, 2010
d3041ff
Solr jar path config added in backend
lbochsler Dec 21, 2010
b0a0ec8
1) Allow to pass multiple values of a facet devided by '|'. Handling …
lbochsler Dec 27, 2010
6a5614c
Additional value check.
lbochsler Dec 27, 2010
66575c3
Allow to choose panel panes aside from normal views pages.
lbochsler Dec 27, 2010
c4b9faf
Merge remote branch 'remotes/dev/drupal-7--1'
das-peter Jan 2, 2011
6b1d1f3
Datatype handling and facet name added for plugins
lbochsler Jan 5, 2011
521d8b6
Merge branch 'master' of git+ssh://git.cando-image.com/drupal/modules…
das-peter Jan 6, 2011
26ea48a
PingRequestHandler in solr config template added, Notice in Solr Servie
lbochsler Jan 7, 2011
0fe35cf
Merge branch 'master' of git+ssh://git.cando-image.com/drupal/modules…
das-peter Jan 7, 2011
f830776
Sort order changed to chronological. Why was it reverse chronological?
lbochsler Jan 7, 2011
3b77270
etid changed to entity_type, current_display in raw data removed
lbochsler Jan 9, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
508 changes: 428 additions & 80 deletions includes/SearchlightDatasource.inc

Large diffs are not rendered by default.

64 changes: 47 additions & 17 deletions includes/SearchlightEnvironment.inc
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,19 @@ class SearchlightEnvironment {
$rendered = array();
foreach ($this->plugins as $name => $plugin) {
foreach ($deltas as $delta) {
if ($render = $plugin->render(drupal_clone($this->query), $delta)) {
if ($render = $plugin->render(clone $this->query, $delta)) {
// Theme each item
$items = array();
foreach ($render as $item) {
$items[] = $plugin->theme($item, $delta);
}
// Generate a label/items array suitable for theme('searchlight_facet')
$rendered[$name] = array('label' => $plugin->label($delta), 'items' => $items, 'delta' => $delta);
$rendered[$name] = array(
'name' => $name,
'label' => $plugin->label($delta),
'items' => $items,
'delta' => $delta,
);
}
}
}
Expand All @@ -127,17 +132,26 @@ class SearchlightEnvironment {
*/
function getBlock($delta) {
if ($delta === 'facets' && $this->initView()) {
// Provide an array with 'unthemed' data for modules implementing
// hook_block_view_alter() in order to have more theming flexibility
$data = array();
$output = '';
$data['container']['name'] = $this->name;
$data['container']['view_name'] = $this->view->name;
$data['container']['facets'] = array();
foreach ($this->render() as $rendered) {
$output .= theme('searchlight_facet', $rendered);
$data['container']['facets'][] = $rendered;
// If we don't get back arrays for items, we directly them them
if (!is_array($rendered['items'][0])) {
$output .= theme('searchlight_facet', array('facet' => $rendered));
}
}
if (!empty($output)) {
$output = "<div class='searchlight-environment searchlight-environment-{$this->name} searchlight-view-{$this->view->name}-{$this->view->current_display}'>{$output}</div>";
return array(
'subject' => filter_xss_admin($this->options['facets_label']),
'content' => $output,
);
$data['label'] = filter_xss_admin($this->options['facets_label']);
$data['content'] = $output;
}
return $data;
}
return array();
}
Expand All @@ -149,6 +163,7 @@ class SearchlightEnvironment {
// Adapted from searchlight_build_view. It should be possible to
// retrieve a data source from a view without running it, untill then...
$split = explode(':', $this->view_display);

if (count($split) === 2 && $view = views_get_view($split[0])) {
return searchlight_get_datasource($view->base_table);
}
Expand Down Expand Up @@ -209,7 +224,10 @@ class SearchlightEnvironment {
if ($datasource) {
$form['facets'] = array('#tree' => TRUE);
$fields = $datasource->fields;
$fields['search_query'] = array('label' => t('Search query'));
$fields['search_query'] = array(
'label' => t('Search query'),
'name' => 'search_query'
);
foreach ($fields as $name => $field) {
if ($this->isValidFacet($name)) {
$form['facets'][$name] = array(
Expand All @@ -219,12 +237,11 @@ class SearchlightEnvironment {
$form['facets'][$name]['enabled'] = array(
'#title' => t('Enabled'),
'#type' => 'checkbox',
'#default_value' => isset($this->facets[$name]['enabled']) ? $this->facets[$name]['enabled'] : TRUE,
'#default_value' => isset($this->facets[$name]['enabled']) ? $this->facets[$name]['enabled'] : FALSE,
);
$form['facets'][$name]['ui_name'] = array(
'#title' => t('Facet'),
'#type' => 'markup',
'#value' => $field['label'],
'#markup' => $field['label'],
);
$form['facets'][$name]['weight'] = array(
'#title' => t('Weight'),
Expand All @@ -235,7 +252,8 @@ class SearchlightEnvironment {
// We instantiate plugins here rather than using initView() as the
// facets on this form may not already be enabled for this environment.
$plugin = searchlight_get_facet($datasource, $name);
$plugin->construct($this, $datasource->fields[$name], $this->getValue($name), isset($this->facets[$name]) ? $this->facets[$name] : array());
$plugin->construct($this, $field, $this->getValue($name), isset($this->facets[$name]) ? $this->facets[$name] : array());

$plugin->optionsForm($form['facets'][$name], $form_state);

$form['facets'][$name]['settings'] = array(
Expand Down Expand Up @@ -265,6 +283,9 @@ class SearchlightEnvironment {
unset($this->facets[$name]['settings']);
$this->facets[$name] = array_merge($this->facets[$name], $options['settings']);
}
if (empty($options['enabled'])) {
unset($this->facets[$name]);
}
}

$this->options = $form_state['values']['options'];
Expand Down Expand Up @@ -301,8 +322,8 @@ class SearchlightEnvironment {
* Get the URL options for the current set of active facets, adjusted using
* one of the $op operations.
*
* 'add': Add a facet value for the given key/value pair.
* 'remove': Add a facet value for the given key/value pair.
* 'add': Add a facet value or multiple facet values for the given key/value pair.
* 'remove': Add a facet value or multiple facet values for the given key/value pair.
* 'active': Retain only active facets and drop any other query strings.
*/
function getURLOptions($op = 'add', $key = NULL, $value = NULL) {
Expand All @@ -315,8 +336,17 @@ class SearchlightEnvironment {
break;
case 'remove':
$modifier = $modifier + $this->active_values;
if (isset($modifier[$key])) {
unset($modifier[$key]);
if (is_array($modifier[$key]) && !empty($value)) {
foreach ($modifier[$key] as $k => $v) {
if ($v === $value) {
unset($modifier[$key][$k]);
}
}
}
else {
if (isset($modifier[$key])) {
unset($modifier[$key]);
}
}
break;
case 'active':
Expand Down Expand Up @@ -348,7 +378,7 @@ class SearchlightEnvironment {
else if (empty($modifier)) {
$exclude[] = $key;
}
$options['query'] = drupal_query_string_encode($query, $exclude);
$options['query'] = drupal_get_query_parameters($query, $exclude);

return $options;
}
Expand Down
1 change: 1 addition & 0 deletions libraries/SolrPhpClient/Apache/Solr/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ protected function _sendRawGet($url, $timeout = FALSE)
}

//$http_response_header is set by file_get_contents
$http_response_header = '';
$response = new Apache_Solr_Response(@file_get_contents($url, false, $this->_getContext), $http_response_header, $this->_createDocuments, $this->_collapseSingleValueArrays);

if ($response->getHttpStatus() != 200)
Expand Down
44 changes: 15 additions & 29 deletions plugins/SearchlightBackend.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ abstract class SearchlightBackend {
*
* @param $datasource
*/
function initClient($datasource) {
}
function initClient($datasource) { }

/**
* Execute a query using the search backend. Should return an array with the
Expand All @@ -99,38 +98,32 @@ abstract class SearchlightBackend {
* 'total': Total number of non-paged results.
* 'raw': The raw result object/array/data from the search client.
*/
function executeQuery(&$client, $datasource, $query = '') {
}
function executeQuery(&$client, $datasource, $query = '') { }

/**
* Set any custom options for the search backend.
*/
function setOptions(&$client, $datasource, $options) {
}
function setOptions(&$client, $datasource, $options) { }

/**
* Set a filter parameter for the search backend.
*/
function setFilter(&$client, $datasource, $filters) {
}
function setFilter(&$client, $datasource, $filters) { }

/**
* Set a sort parameter for the search backend.
*/
function setSort(&$client, $datasource, $sorts) {
}

function setSort(&$client, $datasource, $sorts) { }

/**
* Set a pager/limit parameter for the search backend.
*/
function setPager(&$client, $offset, $limit) {
}
function setPager(&$client, $offset, $limit) { }

/**
* Set node_access attribute filters.
*/
function setNodeAccess(&$client) {
}
function setNodeAccess(&$client) { }

/**
* Utility date methods =====================================================
Expand Down Expand Up @@ -193,8 +186,7 @@ abstract class SearchlightBackend {
/**
* Invalidate the search index associated with this datasource.
*/
function invalidateIndex($datasource) {
}
function invalidateIndex($datasource) { }

/**
* Drush methods ============================================================
Expand All @@ -203,36 +195,30 @@ abstract class SearchlightBackend {
/**
* Start a search backend daemon process through drush.
*/
function drushSearchd($command = 'start') {
}
function drushSearchd($command = 'start') { }

/**
* Start a search backend indexing process through drush.
*/
function drushIndex() {
}
function drushIndex() { }

/**
* Write search backend configuration files through drush.
*/
function drushConf() {
}
function drushConf() { }

/**
* Execute functionality on a drush cron run.
*/
function drushCron() {
}
function drushCron() { }

/**
* When a new site is installed via Aegir.
*/
function drushAegirInstall() {
}
function drushAegirInstall() { }

/**
* When a site is migrated via Aegir.
*/
function drushAegirDeploy() {
}
function drushAegirDeploy() { }
}
Loading