Closed (fixed)
Project:
Project
Version:
6.x-1.x-dev
Component:
ApacheSolr integration
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
8 Jan 2010 at 15:39 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damien tournoud commentedComment #2
damien tournoud commentedA better patch: we can deprecate all the "parent term" custom stuff with a little bit more work in the query.
Comment #3
damien tournoud commentedClean version of the same patch.
Comment #4
csevb10 commentedEverything looks good with the exception of 1 part:
project_sort_freetext. Previously, this was the start of the function: list($query, $response, $parent_term) = project_solr_response_cache();
and while the response and parent_term are unnecessary, $query gets passed to the submit handler. Since $query is never set in the new version, nothing gets set and the submit handler bombs out on trying to call methods of the query class.
Comment #5
csevb10 commentedOk, this turned out to be a bigger issue than expected because on post, none of Solr actually gets executed. As a result, as far as the system is concerned, apachesolr_has_searched() is false, and therefore the block never gets drawn and the submit handler never gets executed. apachesolr_search_view is the culprit (commenting out the $_POST if statement fixes the submission, but the form submit redirect still doesn't behave as intended), but I still need to do more investigation to figure out what can be accomplished.
As promised, I'm attaching a patch update to this that fixes the original submission problem but still suffers from the problem just described. The following 2 lines are the only real addition to the patch:
Comment #6
pwolanin commentedrelated here wr.t. the POST check: http://drupal.org/node/735318
Note - it's bad to remove this or every search runs twice.
Comment #7
makara commentedsubscribing.
Comment #8
makara commentedChanged two things.
1. The tid is in
'im_vid_'. _project_get_vid() .':'not'tid:'2. In form
project_sort_freetext(), I don't think we need the query, so changed that and the submit handler.There's another thing in doubt. I don't know which version of Apachesolr you are using, but in 1.0,
$new_query->get_path();returns something like "project/modules/xxx", not "project/modules?text=xxx".Comment #9
dwwIs this "needs work" for a known reason, or is this actually ready for review and testing?
Comment #10
damien tournoud commentedOn a visual inspection, it seems to me that #8 should basically work. I passionately hate the changes to
project_sort_freetext()(building the URL manually, without calling the URL-building mechanism in the query object), but it is not obvious we can actually do better.This block will only work on our special browsing page, not on standard Apachesolr search results, but I cannot see any way to support both.
Comment #11
makara commentedOK, so I override
get_path()inProjectSolrQueryclass so it doesn't keep the search query in the path (because we add the query to ?text=...). Now the blocks (the 4 in project_solr.module) work as expected. Please review.Comment #12
pwolanin commentedre: #5 - the latest apachesolr code in CVS does away with the $_POST check. Will be in an official 6.x-1.1 release soon.
Comment #13
dwwWe're actively trying to upgrade apachesolr on d.o right now. Given the latest version of apachesolr, there's no need for our custom project_solr_order block anymore. So, this new patch removes that block entirely. It also undoes the change that was truncating the number of categories in the module categories facet block.
This is mostly working now on scratch.drupal.org. The one exception is that the default sort order is now lost, and back to using alphabetical. We want to default to usage stats descending. See #406728: Default sort on Modules / Themes pages for more.
Comment #14
dwwThere was some stray whitespace in project and project_solr that was causing some conflicts. Just committed fixes for those separately, so here's a reroll that applies to the branch.
Comment #15
csevb10 commented1-line modification to change the default sorting method from title asc to usage desc.
Comment #16
dwwActually, #15 isn't needed at all. #14 is what we want. The problem was that the variable that sets the desired default sort for us is being defined in settings.php and the $conf values in settings.php are different between d.o and scratch.d.o. See #849634: Find a sane way to put (most of) settings.php into bzr for coordinated deployment across staging + live for more. ;)
Comment #17
dwwActually, looking more closely at this patch, there were some really crazy ternary operators inside foreach() in the previous code. I moved the isset() out of the foreach() to make the code more readable. This patch is now on scratch.d.o and seems to be working fine:
http://scratch.drupal.org/project/modules
I'm planning to commit this and deploy live ASAP.
Comment #18
dwwCommitted to HEAD and deployed to scratch.d.o and d.o. Working fine:
http://drupal.org/project/modules
Yay! Onwards to the d.o redesign. ;)