Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I am playing around with solr and views3. My first view with solr has an exposed search filter.
The exposed filter is not an autocomplete widget, but it would be great to have it the same autocomplete as the normal search box.
Mark it as a feature request, but there could be a way and I haven't find it yet.
Comments
Comment #1
janusman CreditAttribution: janusman commentedHmm, must be in a good mood today =) How about this patch?
Please test.
Comment #2
vanillawater CreditAttribution: vanillawater commentedHi,
Regarding the patch, I am getting apache2 logs :
PHP Fatal error: Cannot redeclare apachesolr_autocomplete_form_alter() (previously declared in ../sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete.module:45) in ../sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete.module on line 78, referer: http://../admin/settings/apachesolr/settings
Thank you in advance.
Comment #3
janusman CreditAttribution: janusman commentedPlease make sure you try it against a fresh download...
Comment #4
rjbrown99 CreditAttribution: rjbrown99 commentedI'm using the Apachesolr Views module, and I had to make an addition to the patch to get an exposed filter working on my site. The base_table for my view is apachesolr_node and not apachesolr, so I accounted for that in the if statement. This is the same patch as #1 with that addition to the if.
Comment #5
rjbrown99 CreditAttribution: rjbrown99 commentedThe one thing I noticed with this patch is that the calculation for number of results seems to be incorrect. It may not be taking in to account the existing facet choices that may have already been made. For example, my left facet has "Category A" selected, where the search box just refines the results. I would expect autocomplete to only search "Category A" for "Keyword" and suggest say 10 results. Instead, it seems to do a global search on "Keyword" and suggests 100 results.
In the end the search works properly after submit - it only returns the 10 results. However the numeric calculation for number of results was wrong. I hope that makes sense.
Comment #6
janusman CreditAttribution: janusman commentedRe: #5: yeah, in fact that can also be reproduced by using the "Retain current filters" on the /search/apachesolr_search page... the reported # of results numbers might not be accurate since the active filters are not taken into account.
That, however is impossible using the Drupal core taxonomy widget, but might be with the new custom JS widget.
A workaround for now is to copy the theming functions over to your theme and making those not show the result counts.
Leaning towards a simple solution: allow admins to switch off counts using the admin UI. That would get this patch through to enable support for Views 3. Marking as "needs work" for now.
Ideas, patches, feedback welcome =)
Comment #7
N1ce0ne CreditAttribution: N1ce0ne commentedHello,
I have installed the Patch "apachesolr_autocomplete-719382-4.patch" the Patch works fine, i can see the little clock that autocomplete looking for something but there are no results.If I search with Apache Solr search the autocomplete works.
Can you help me pls?
Regards
Comment #8
Equinger CreditAttribution: Equinger commentedI have the same problem as #7
Comment #9
Equinger CreditAttribution: Equinger commentedI corrected problem #7 by adding the following line:
$form[$id]['#attributes']['class'] .= ' apachesolr-autocomplete unprocessed';
Before, it was acting as a generic autocomplete form.
Comment #10
scotjam CreditAttribution: scotjam commented#9 worked for me, no idea what it does any why I need it, but it works. Thanks for this.
But, I'm finding that when I click on a selection, the search query doesn't get updated with the selection. Instead the 'half' text that I entered to trigger the autocomplete is used as the query text. I'm using the new custom widget, which other than the above works fine.
Update.. problem above experience with FireFox 3.6, but IE7 and Opera 10 work just fine.
Comment #11
scotjam CreditAttribution: scotjam commentedJust a kind request...
Could the patch in #4 (in addition to the fix in #9) be included into the module?
cheers
scotjam
Comment #12
janusman CreditAttribution: janusman commentedThe patch from #9 did get in, see the diff here:
http://drupalcode.org/project/apachesolr_autocomplete.git/blobdiff/f3f06...
So switching over to analyzing the patch in #4... for now, could you (or someone) please re-roll the patch so that it applies to the current branch(es)? Because of this, leaving as "needs work".
Also, I'm really trying to keep the 6.x and 7.x branches in sync, but I have not checked how ApacheSolr Views for 7 is coming along, so that might offset the actual committing of the patch to the 7.x branch.
Comment #13
scotjam CreditAttribution: scotjam commentedNever worked with cvs before, so I manually apply patches.
But to give this a go, I've used diff. So beware! this is my first re-roll of a patch.
It's for 6.x-1.x-dev.
Hope this works / helps
Comment #14
dirtysteak CreditAttribution: dirtysteak commentedTried patch in #13 and got no result.
Replacing line 100 of the .module file with:
$form[$id]['#attributes']['class'] .= ' apachesolr-autocomplete unprocessed';
did work, however.
We are running a bleeding edge setup, views 3, solr search 6.2. Seems to be working so far.
Comment #15
scotjam CreditAttribution: scotjam commentedThat's weird,
I thought #9 was already in there, but it doesn't look like it does. I can't spot the line in the diff given in #12.
help.
Comment #16
janusman CreditAttribution: janusman commented@scotjam: The new function apachesolr_autocomplete_do_alter() is now doing the concatenation of the extra class =)
Setting as needs review.
Comment #17
picxelplay CreditAttribution: picxelplay commented#13 + #14 works good, but, Facet blocks disappear after you click an autocomplete result.
Comment #18
puzl CreditAttribution: puzl commentedwhoops
Comment #19
janusman CreditAttribution: janusman commentedThis will now need work since the patch will probably no longer apply.
Comment #20
alibama CreditAttribution: alibama commentedCorrection: works well with #14. Have pushed it to the repo below
hi all, tested against the latest release of solr views + autocomplete. The little ajaxy circle is there, but it doesn't actually do anything at this point am testing here, if anyone wants ownership am glad to share ;P
https://github.com/alibama/apachesolr-autocomplete-drupal
thanks for the great mod, latest patch below, am new with creating patches, so let me know what needs doing...
Comment #21
alibama CreditAttribution: alibama commenteder, here's the patch, anyone testing it please let me know if it's straight
Comment #22
janusman CreditAttribution: janusman commentedThanks @alibama, did you mean to set this as "needs review"?
Comment #23
alibama CreditAttribution: alibama commented@janusman = that's what i meant to say ;) thanks = yes, patch needs review, and if you would be so kind as to explain my mistakes so that I'll learn how to do this correctly next time it'd be most appreciated - also while this is a very simple module I've gone ahead and done a small write-up +vid documentation here
http://blog.hsl.virginia.edu/drupalpress/apachesolr-autocomplete-for-vie...
Thanks all for the great tools = much appreciated
Comment #24
janusman CreditAttribution: janusman commentedPatch from #21 looks good. I'll do some testing and post back. (Also, need to see how this'll work in 7.x)
Comment #25
mike27 CreditAttribution: mike27 commentedAny news about that in drupal 7?
mike
Comment #26
semanthis CreditAttribution: semanthis commentedFor Drupal 7 just add the folloing code to apachesolr_autocomplete.module before these lines
"/**
* Helper function to do the actual altering of search forms."
Sorry for not sending a patch my module is already patched several times...
Comment #27
luo8 CreditAttribution: luo8 commentedhello Alibama,all,
did you already setup somebody of you searching as you mentioned in #5?
I would like to use just one search block with autocomplete and "Retain current filters" support .
Currently after searching I could see exposed filters, if I checked(active) one of Taxonomy filter(f.e. cars) and do new search, I see results include all non active filters (flats,mobiles...) as well and there is problem I would like to see just result for specified current filters.
Alibama have implemented it in his site http://www.hsl.virginia.edu/...
Pls. could you help me somebody?
Thanks
Comment #28
luo8 CreditAttribution: luo8 commentedComment #29
alibama CreditAttribution: alibama commentedhi luo8,
is your goal to implement this in D7? I'm not quite there yet, need to work on it - will keep an eye on this thread
Comment #30
luo8 CreditAttribution: luo8 commentedalibama,
yes I working with D7.
On which version did you implemented it?
Are you using taxonomy,content type or fields filer?
Is posibility to have more filters?
Thanks
Comment #31
alibama CreditAttribution: alibama commentedwe are on d6 with content types, had a hard time getting more filters. am going to begin testing with d7 in the next few weeks and hope to have better answers then
Comment #32
luo8 CreditAttribution: luo8 commentedhello alibama,
I believe you that was a hard time.
It's pitty that is not working with taxonomy terms,do you think that could be possible to make it functional with Taxonomy?
Do you have live page with more filter's working,may I see it?
Thanks.
Comment #33
aaronglamb CreditAttribution: aaronglamb commentedA patch for #26 above. Please test away.
Comment #34
luo8 CreditAttribution: luo8 commentedDear all,
after "flush all caches" autocomplete module is unfunctional...
Why I can not use Retain current filters ? Is bug?
Comment #35
kevster CreditAttribution: kevster commentedIm trying to get this working on latest dev version as I dont get the autocomplete circle showing.
I have a search view with a fulltext search exposed field on that works fine but not with autocomplete (exposed form in block). If I apply the patch in #26 I get an extra search field below the submit button for my first field and this does have an autocomplete circle.
If I type text in to the new field I get a list of relevant results back, then select one but my search result brings back all results (not filtered). Looking at the URL I see:
xxxx/solrsearch4?search_api_views_fulltext=&keyword=bergeon+each
If I change it to:
xxxx/solrsearch4?search_api_views_fulltext=bergeon+each&keyword=bergeon+each it works but its relying on both my search fields being populated with the same value?
Should my original search field be replaced with the new one using this patch?
orig field -
new field -
Any help would be much appreciated! Very useful module and great for a 10k product site, I think I must be 98% there...
Drupal 7.22
Apache Solr framework 7.x dev
Apache Solr search 7.x dev
Apache Solr Views Integration 7.x-1.0-beta2
Apachesolr Commerce 7.x-1.x-dev
Commerce 1.5
Comment #36
kevster CreditAttribution: kevster commentedSorry - attached screengrab showing both fields...
Comment #37
kevster CreditAttribution: kevster commentedIve managed to resolve my issue - because my exposed search field was not named keyword the patch added another search field. My tweaking the patch to target my exposed field name it all worked ok. This shouldnt be field name specific so Im assuming there is something wrong my end but at least I have it working now.
Its a great feature and definitely a big bonus from a UI perspective and also helping filter 10,000 prods ;-)
Comment #38
sylus CreditAttribution: sylus commentedAttaching patch for latest dev.
Comment #39
alibama CreditAttribution: alibama commentedThis patch worked with the same relatively disastrous results mentioned above.... now all my exposed filters have an extra apachesolr autocomplete field in them... .ugh
Comment #40
alibama CreditAttribution: alibama commentedwould you mind posting some of the changes you've made to your autocomplete patch? I can't seem to get it running... Thanks
Comment #41
Robert Castelo CreditAttribution: Robert Castelo commentedshould be == instead of =
Comment #42
luo8 CreditAttribution: luo8 commentedHello,
make it functional you ca use another way as well...you need to install "Facet API Pretty Paths" module..
Comment #43
Robert Castelo CreditAttribution: Robert Castelo commentedNote that the auto-complete does a site wide search for everything that's been indexed, it's not filtering the results by the filters that have been set up on the View.
So currently this is useless for anything except the site wide search.
Comment #44
pio.fernandes CreditAttribution: pio.fernandes at Redweb commentedThe last patch was not working without a context variable.
I know this is an old one, but here's a new patch, it might help someone who uses apachesolr suite and not the search_api, like me.
Comment #45
pio.fernandes CreditAttribution: pio.fernandes at Redweb commentedComment #46
pio.fernandes CreditAttribution: pio.fernandes at Redweb commentedCorrecting filename.
Comment #47
melonangie CreditAttribution: melonangie commentedI got the error below when trying to apply patch #46. I just put it the code my self and created another patch from a fresh 7.x-1.x-dev.