Related Issues

This issue is a sub-task of #1699164: [Meta] Port drupal.org's solr search functionality to D7

  1. #1549374: Upgrade drupalorg_crosssite to support 6.x-3.x version of Apachesolr (Prep for D7 d.o)
  2. #1548064: Upgrade drupalorg to support 6.x-3.x version of Apachesolr (Prep for D7 d.o)

Problem/Motivation

Because d.o will transition to D7 before the other *.d.o sites, we need to support multisite apachesolr access across both D6 & D7 sites in the infrastructure.
Multisite search using apachesolr requires 6.x-3.x to work correctly with 7.x sites.
Multisite search using apachesolr also requires apachesolr 6.x-3.x.
So, to facilitate our mixed D6/D7 environment, we'll need to upgrade project to support apachesolr 6.x-3.x and play nicely with apachesolr_multisitesearch 6.x-3.x (and deploy 6.x-3.x versions to all D6 environments in the infrastructure).

Remaining tasks

  1. getSolrsortUrlQuery isn't a direct port of the previous get_url_queryvalues. Basically, most of the get_url_queryvalues have been ported directly to the getSolrsortUrlQuery which isn't accurate. get_url_queryvalues contained fq params, but getSolrsortUrlQuery does not, so we get (or will get) different behavior for these elements.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

I'm certainly in favor. However, it's not clear what actually has to happen here. ;) Any chance you could update the summary with more specific info on what needs to be upgraded for this to work, instead of the general motivation for why we want to upgrade?

Thanks,
-Derek

jhedstrom’s picture

I'll update it as I can--the main issue is that the apachesolr api changed names for just about everything between 1.x and 3.x, so mainly what needs to change in Project are function and method names. I have a working patch I'll post soon.

dww’s picture

Project: Project » Project ApacheSolr integration
Version: 6.x-1.x-dev »
Component: ApacheSolr integration » Code

After a brief discussion here at the sprint in PDX, we decided the sanest thing to do was to move project_solr into an entirely separate project + Git repo, and then just provide different branches of it that work with apachesolr 6.x-1.x vs. apachesolr 6.x-3.x. Branching all of Project for this seemed like a mess, but just having this small add-on module as a separate project/repo makes a lot of sense.

Nick_vh’s picture

Version: » 6.x-1.0

I'm more than happy to help. Give me an email if you decide to do the sprint. I've been responsible for most of the function and API changes in the solr 6.x-3.x branch (which are exactly the same as 7.x-1.x) so I ow that to drupal.org ;-)

dww’s picture

Sweet, thanks Nick_vh! I'm going to defer to jhedstrom and csveb10 at this point, since they were the ones moving this forward at the PDX sprint and I've got my hands with a bunch of other efforts happening in parallel. But, if I can be of assistance in any way, please let me know ASAP.

Thanks!
-Derek

Nick_vh’s picture

Status: Active » Needs work
FileSize
20.49 KB

First attempt,

sorry for the whitespace fixes

csevb10’s picture

No apologies for fixes of any sort.
I've cleaned up a few issues, and committed the bulk of this patch since it moves us in the right direction and people are sprinting tomorrow, but there is plenty that still needs to be cleaned up.

There are definitely plenty of areas that still need to be addressed, however. Do a search for has_filter to identify some of the problem areas. A lot it centers around the project/modules pages, but some of it affects the surfaced search criteria on the search page as well.

Thanks for the efforts and all the progress that's been made thus far. drupalorg_search & drupalorg_crosssite have been similarly updated.

Nick_vh’s picture

I'm not even sure if this module needs upgrading at all. I tried drupal.org to see where the paths of this module are in use and it doesn't even seem to be in use?

Nick_vh’s picture

Version: 6.x-1.0 » 6.x-3.x-dev
FileSize
22.02 KB

So I continued anyway, I figured the hook_menu's were really weird but other stuff was being used. This project does need a lot of love if we want to keep continue it though!

What was done :

  • Removed the customer query class, that was not necessary
  • progressed and looked over the whole module for deprecated functions and replaced them with the apachesolr 6.x-3.x functions
Senpai’s picture

Issue tags: +ApacheSolr, +drupal.org D7, +sprint 6

Tagging for Sprint 6.

csevb10’s picture

Ok, overall this patch (plus a bunch of cleanup on my end) gets us close to a working product.
I see 1 item for cleanup:

  • getSolrsortUrlQuery isn't a direct port of the previous get_url_queryvalues
    Basically, most of the get_url_queryvalues have been ported directly to the getSolrsortUrlQuery which isn't accurate. get_url_queryvalues contained fq params, but getSolrsortUrlQuery does not, so we get (or will get) different behavior for these elements.

We should test that this works for all appropriate use cases:

  • search [main search and search box]
  • project/* (project/modules, project/themes, etc) [main listing, search box, and sidebar blocks]
  • download & extend (/download) [blocks]

Once those 2 are taken care of, we should have a generally working project, then, let's see if we can transition the elements out of custom code and better leverage the apachesolr module.

We're close to a working product at this point. Much thanks to nick_vh for all his hard work moving this forward.

Senpai’s picture

Issue summary: View changes

Adding sub-tasks

Nick_vh’s picture

Same here, was this committed to the branch or how does the process work? Please be more clear in what was committed

Nick_vh’s picture

FileSize
39.86 KB

I was able to work more on this and I think this gets us to a working product. Can you notify me when this gets committed to the 6.x-3.x branch so I can deploy that on the dev server of drupal.org?

Nick_vh’s picture

FileSize
59.76 KB

More complete patch here.

This patch fixes the special form for the module facet, also the special page project/$project_type and project/$project_type/categories

Nick_vh’s picture

Status: Needs work » Needs review
Nick_vh’s picture

Status: Needs review » Needs work
+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
+      if (preg_match('/^im_vid_'. _project_get_vid() .':(.*)$/', $query_snippet, $matches)) {

check if this actually works. Should be doable in a less quirky way.

+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
+    if ($filter['#name'] == 'tid') {

change tid with im_vid_project_vid_id

+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
+      $new_query->removeFilter('tid', $term->tid);

change tid with im_vid_project_vid_id

+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
+      $new_query->addFilter('tid', $term->tid);

change tid with im_vid_project_vid_id

+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
+          $options['query'] = project_solr_append_api_term($new_query->get_url_queryvalues(), $tid);

get_url_queryvalues does not exists anymore. Upgrade this

+++ b/project_solr.blocks.incundefined
@@ -0,0 +1,137 @@
\ No newline at end of file

add a newline

+++ b/project_solr.moduleundefined
@@ -209,19 +262,21 @@ function project_solr_apachesolr_index_document_build_node(ApacheSolrDocument $d
+      $document->addField('iss_project_release_usage' ,$total_usage);

decide wether it is better to be consistend and use addField everywhere or addMultipleValue/addValue

+++ b/project_solr.moduleundefined
@@ -942,25 +460,16 @@ function project_sort_freetext_submit($form, &$form_state) {
+    'fl' => 'id,entity_id,label,im_project_release_api_tids',

remove the im_project_release_api_tids here. Debugging purpose

+++ b/project_solr.moduleundefined
@@ -1096,8 +608,66 @@ function project_solr_add_sorts(&$query, $api_filter = 'im_project_release_api_t
+  $filters_url = $_GET['f'];
+  foreach ($filters_url as $filter_url) {
+    $filter_url = explode(':', $filter_url);
+    if (is_array($filter_url)) {
+      $facet_alias = variable_get('project_solr_project_release_api_tids_alias', 'drupal_core');
+      if ($filter_url[0] == $facet_alias) {
+        $filter_url = array('key' => 'im_project_release_api_tids', 'value' => $filter_url[1]);
+      }
+      else {
+        $filter_url = array('key' => $filter_url[0], 'value' => $filter_url[1]);
+      }
+      $filters = array_merge($filters, array($filter_url));
+    }

find a better way to get the facets from the url, leveraging facetapi as the parser.

+++ b/project_solr.pages.incundefined
@@ -0,0 +1,207 @@
+    // Fetch our text and url values
+    $text_query = arg(2);
+    $filters = isset($_GET['f']) ? $_GET['f'] : '';
+    $sort = isset($_GET['solrsort']) ? check_plain($_GET['solrsort']) : '';
+    $page = isset($_GET['page']) ? $_GET['page'] : 0;

make sure this stuff is secure. Also leverage facetapi as the parser.

Senpai’s picture

Issue tags: -ApacheSolr +solr

Retagging from 'ApacheSolr' to 'solr'.

Nick_vh’s picture

FileSize
59.87 KB

Posting an update

drumm’s picture

Status: Needs work » Fixed

Committed as-is. Review is kinda hard since refactoring is mixed in as well. Followups should be in separate issues.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Adding sub-tasks.