Closed (won't fix)
Project:
Apache Solr Organic Groups Integration
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
16 Sep 2009 at 18:42 UTC
Updated:
24 Jul 2012 at 12:12 UTC
Some code from groups.drupal.org for a group specific search block. Since the integration module is owned by apachesolr right now - tag you're it.
function groupsorg_groupsearch_block_view() {
if (!module_exists('apachesolr') || !user_access('search content')) {
return;
}
if ($groupnode = og_get_group_context()) {
$block['content'] = drupal_get_form('groupsorg_groupsearch_form', $groupnode);
$block['subject'] = l($groupnode->title, "node/$groupnode->nid");
return $block;
}
}
function groupsorg_groupsearch_form(&$form_state, $groupnode) {
if (!empty($groupnode) && !empty($groupnode->nid)) {
$form['filters'] = array(
'#type' => 'hidden',
'#value' => 'im_og_gid:' . $groupnode->nid,
);
$form['retain-filters'] = array(
'#type' => 'hidden',
'#value' => 1,
);
$form['#action'] = url('search/apachesolr_search');
$form['#method'] = 'GET';
$form['keys'] = array(
'#type' => 'textfield',
'#title' => t('Enter keywords'),
'#description' => t('Search is automatically restricted to posts in this group.'),
'#size' => 40,
'#maxlength' => 255,
);
$form['search'] = array(
'#type' => 'submit',
'#value' => t('Search'),
);
return $form;
}
}
Comments
Comment #1
jpmckinney commentedI don't understand. This just looks like a good example of how to use the apachesolr API. What exactly is the proposed patch?
Comment #2
moshe weitzman commentedapachesolr_og was (is?) part of apachesolr project. this was code contributed for that module.
Comment #3
jpmckinney commentedPunting to Apache Solr Organic Groups Integration in case the maintainers want to do something with it.
Comment #4
ebeyrent commentedI'll take a look - thanks Moshe!
Comment #5
jvieille commentedIs that what I am looking for?
http://drupal.org/node/871332
I am very interested by this mandatory enhancement for using Apache Solr with the great OG series.
Note: Drupal core search respects OG context for returning only group relevant information and keeping its context unchanged.
Comment #6
jvieille commentedI is said that Apache Solr is used by drupal.org
groups.drupal.org presents a search block that restricts the search to the current group. If groups uses Apache solr too, that would mean that OG search is available.
In my case, the OG standard Group Search block does not make it.
How to get this apparently available feature on?
Comment #7
jvieille commentedHow to get an OG group search block?
groups.drupal.org uses Solr and has it, so it should be available.
How do they do that?
Thanks
Comment #8
nick_vh6.x-2.x has become unsupported. If you want to see how groups.d.o does it, I suggest you look at drupalorg module or project module? All modules used by d.o and g.d.o are available on drupal.org
Comment #9
nick_vh