Closed (fixed)
Project:
Apache Solr Autocomplete
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2012 at 14:21 UTC
Updated:
27 Nov 2015 at 20:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
martins.bertins commentedI remade the patch, because it uses relative path. But otherwise it works as supposed. Thanks stijn.blomme, I was wondering about this problem.
Comment #2
rodlangh commentedJust what I needed, thanks!
Comment #3
allie mickaSee #1577842: custom search page integration with custom search filters
This patch adds the autocomplete to the custom search pages, but it does not perform a different search based on the custom search page's configuration.
Comment #4
janusman commentedYes. I believe the form_alter has to somehow write additional parameters based on what the context is... so each autocomplete request would have to pass that context along to modify the Solr query to build the autocomplete results.
Comment #5
allie mickaSee also #1474176: let query alter know which autocomplete it was called from, from liquidcms:
Comment #6
allie mickaThis patch builds on the earlier ones and adds the custom search page id to the autocomplete path. The result is autocomplete behavior that appears properly on custom search pages, and suggests autocomplete results that are correctly scoped for that search.
I have tested this on the Drupal core autocomplete widget, but I wasn't able to get the Custom autocomplete widget working quickly, so it's not tested for that widget.
Please try this out on both widgets and let's get this added :)
Comment #7
mike27 commentedThank you, well done!
m
Comment #8
janusman commentedThis is patch for D6 6.x-1.x. Needs testing for compatibility with 6.x-3.x branch of ApacheSolr Search... I think it might work out of the box due to some extra logic I put in there.
TODO: coming soon: patch for 7.x-1.x
Comment #9
janusman commentedPatch for D7.
Comment #10
rajivk commentedAfter applying the above patch in dev branch I got following warnings
Following new patch corrects it.
Comment #11
conniemh commentedWhen I tried applying the D7 version of the patch to one of our dev servers here, apache solr would not index. Has anyone else who tried this patch have similar problems? I am currently working on a project with two separate search filters and could really use this feature.
Thanks,
Connie
Comment #12
rajivk commentedI am facing similar problem but I noticed that I can't do batch job (drupal/batch?op=start&id=) . Currently for doing a batch job, I have to disable autocomplete module.
Comment #13
drupalusering commentedInterestingly the very first patch,
Solved the problem and even respects the domain access module. It only pulls up the content available on my subdomains. Just letting know to anyone else using domain access and the autocomplete modules
Comment #14
dysrama commentedI tried to apply the patch in #9 but it wouldn't apply, so I had to do it manually.
Anyways, this patch does most of what I'm looking for, but it doesn't have support for different solr environments.
I added this functionality based on the patch in #9. The only other change I made was removing backwards compatibility for d6, that has no place in a d7 module as far as I see?
Comment #15
dysrama commentedFound a bug in above patch, tried to load the search page twice. Fix in included patch.
Comment #16
polTo get it working, this should be replaced by:
$search_page_id = $form['#search_page']['page_id'];Other than that, everything is working as it should.
Patch attached.
Comment #17
polThere's still a problem with the patch.
When editing mini-panels, I don't have the possibility to add content because there is a javascript error:
Uncaught TypeError: Cannot read property 'path' of undefinedAdding
drupal_add_js(array('apachesolr_autocomplete' => array('path' => '')), 'setting');in the
hook_init()solve the problem but maybe there's a cleaner solution. Anyone ?Comment #18
jurcello commentedI checked if the variable was set in javascript. I don't know if this is cleaner, but it works.
I based the patch on comment #15.
Comment #19
janusman commentedOk, thanks all for chiming in.
Let's first try to gt this working on 7.x, then we can backport.
It's great a lot of the above patches work, but there's one thing that's missing (and is actually on the patches) :
I'm working on a patch that's able to handle different environments, see below.
Some notes:
* This would mean that, for consistency, we would have to altogether drop the option to use the Core autocomplete widget. That would, however, open up the way to also fix the "Retain current filters" option consistently. This patch still has not removed the " Autocomplete widget to use" option nor logic, but will only work if you set the widget to be the Custom one on the module settings.
* This adds a data-apachesolr-autocomplete-idattribute to the form to know what environment we're talking about. Not sure if this will work cross-browser or not... need a Javascript/jQuery sanity check =)
* This also raises the question if we will want/need per-environment settings instead of global ones. For instance: enable spellcheck suggestions for just one of the environments.
* Have not tested this yet with panels, testers welcome.
If you're testing this, note:
* You need to switch the autocomplete widget to the "Custom" one on the settings page.
* this might cache clear is needed if you're working with aggregated JS.
So, TODO:
* Panels testing
* Remove logic/code for Drupal core widget, the custom widget would be the only option available.
Comment #20
raulmuroc commentedTested and it retrieves the following error:
Comment #21
raulmuroc commentedComment #22
SamRose commentedTested patch above in #19 https://drupal.org/node/1444038#comment-6993306
Got 1 hunk out of 13 failed
Comment #23
jarrodirwin commentedRe-rolling patch against the latest dev release.
Counts on custom pages still were not showing correctly for me. Found it was due to $search_page not being passed to apachesolr_autocomplete_basic_params() in one instance.
Have added this fix.
Comment #24
pol#23 works perfectly, thanks !
Comment #25
raulmuroc commentedComment #26
beeradb commentedThe previous patches didn't work on panelized search pages, this updated patch add an additional form alter so the search widget pane is included.
Comment #27
beeradb commentedArgh. I got the search input key incorrect in the previous patch. This one fixes it.
Comment #28
janusman commentedCrosslinking #1061260: Apache Solr Panels Integration which is around Panels integration... we probably want the patch from #27 above without the panels integration (for now!) and when this is committed then we can work on the panels integration full-on.
The code does look good at first glance. I hope I can finally test this soon.
Comment #29
janusman commentedJust to keep this somewhere... attached is a small improvement to the patch for D6 in #8. Still waay behind the latest D7 one, but putting here to catch up after the D7 one is committed.
Comment #30
beeradb commentedIt looks like a proper review still hasn't been done on #27, so moving back to needs review.
Comment #31
thepanz commentedI reviewed the patch in #27, it wasn't working as expected due to some JS errors (apachesolr_autocomplete was wrongly replaced with "autocomplete", other jQuery selectors wasn't working properly).
I removed the Panels integration as for #28
@todo: remove some 6.x back compatibility checks?
Please review my patch here
Comment #32
raulmuroc commentedLast patch with latest -dev works correcly for me.
Thank you.
Comment #33
thepanz commentedA small edit:
in
function apachesolr_autocomplete_do_alter(&$element, $form) {the first lines should be
This allow the autocomplete to work even if multiple search forms are placed in a same page (required for new module I'm implementing to allow pages to also provide separated search-blocks).
Regards
Comment #34
michel.settembrino commentedI am using patch #23 in one of our website running with module Apache Solr autocomplete version 7.x-1.3
I am now updating my website and I tried to update the module to version 7.x-1.4 and apply this patch. Unfortunately this didn't worked.
Has someone of you a solution?
Comment #35
thepanz commented@mstv287: did you try patch in #31?
Comment #36
michel.settembrino commented@thePanz I tried to apply patch in #31 and it got applied with the exception of this part:
I didn't understood why this can't be applied but I did the change manually and the autocomplete function is working!
Many thanks for your help.
Best regards,
Michel (mstv297)
Comment #37
thepanz commented@mstb297: the patch is meant for -dev release of the module :)
I am moving this to Tested by community since 2 devs confirmed it is working :)
Comment #38
mas0h commentedPatch applied partially, not all the patch on the latest dev.
Comment #39
nitebreedThe patch in #31 has a serious bug:
jQuery(".apachesolr-autocomplete.[data-apachesolr-autocomplete-id='"+ key +"']", context)should be replaced with:jQuery(".apachesolr-autocomplete[data-apachesolr-autocomplete-id='"+ key +"']", context)Comment #40
raulmuroc commentedLooks committed. I download latest dev and see all the code of the latest #31 patch is there applied. So fixed.
Comment #41
nitebreedNo, obviously not fixed. See my comment #39.
Comment #42
piyuesh23 commentedUpdated the patch with the suggestion in #39
Uploading the updated patch below.
Comment #43
piyuesh23 commentedComment #44
rupertj commentedPatch in #42 appears to be backwards. (IE it removes the changes...) Just needs a re-roll with the branch names reversed, I suspect.
Comment #45
n20 commentedYes, seems to be committed. Still the autocomplete doesn't work on my custom search pages.
Comment #46
italdenko commentedComment #47
italdenko commentedComment #48
nitebreedN20, do you see javascript errors in your console? I also implemented the patch and it's working for me
Comment #49
n20 commentedNo errors at all. I now have the core search block (search_block_form) working in my panel. Problem is that this form is redirecting to cores search page 'search/site'. But i have a custom search page setup.
If i use the Apache Solr search form, which has the option to override the path doesn't have autocomplete at all.
In my case i need to get either the core search to redirect to somewhere else or the Apache Solr form to play nicely with autocomplete.
Comment #50
janusman commentedNew patch, against fresh checkout of master.
Includes #2596777: The current search page ID is not passed as a context, like a normal apache solr search
Comment #51
janusman commentedNew patch, since a lot of changes made it into 7.x-1.x yesterday.
Please test!
(Note: 'master' branch is being deprecated to now use 7.x-1.x)
Comment #52
janusman commentedNew patch. I will commit this soon.
Comment #54
janusman commentedCommitted! Thanks all!