Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Aug 2011 at 23:17 UTC
Updated:
2 May 2012 at 01:39 UTC
Jump to comment: Most recent file
Comments
Comment #1
cpliakas commentedThe issue posted at #1252644: Remove assumption that the facets will link back to the page they are on is the corresponding thread in Facet API.
Comment #2
cpliakas commentedThe attached patch is an attempt at at least showing how I plan on approaching this. I understand there are assumptions in here, but I am unclear how this solution would look with multiple environments, search pages, etc. Any information you can provide surrounding the assumptions you see would be helpful.
After installing the patch, you can see how setting the pages will show the facet blocks although they don't work.
Thanks,
Chris
Comment #3
pwolanin commentedSo, this should basically work the same as the facet browsing blocks - i.e. the query is for everythign in the index (or with e.g. just node access filters applied)?
Comment #4
cpliakas commentedYes. Exactly the same, but with the pages being configurable.
Comment #5
Refineo commentedsubscribing
Comment #6
cpliakas commentedLatest patch, some assumptions removed. Also added a sanity check for backwards compatibility so we don't have to do a coupled release. The counterpart to this patch is posted at http://drupal.org/node/1252644#comment-4919158.
Comment #7
cpliakas commentedThis is coupled with the work being done in the Facet API non-search-facets branch.
Comment #8
pwolanin commentedSo, I think this needs work to couple it to a specific search environment.
looks like these lines need to be adjusted:
However, I'm not sure how to avoid overlapping path settings for different environments.
Comment #9
Refineo commentedafter applying the apachesolr-1252648-6.patch together with the facet api patch (http://drupal.org/files/issues/facetapi-1252644-2.patch for #1252644: Remove assumption that the facets will link back to the page they are on) ,
I got WSOD:
Then I restored database tables and it is corrected now. Testing further...
Comment #10
pwolanin commentedwhy did you change the status?
Comment #11
pwolanin commentedComment #12
cpliakas commentedWould it ber reasonable to change the settings to arrays keyed by the environment ID? The sticking point I had was getting the environment of the search being executed. Any input on this, or am I overthinking what needs to be done?
Thanks,
Chris
Comment #13
cpliakas commentedHere is a re-roll of the patch against the latest 7.x-1.x code. As mentioned in #8, this patch supports per-environment settings by taking the approached suggested in #12. Note that with the latest version of Facet API, we run into issue #1379166: The Current Search Block is displayed on the search page even when no search has been executed. Depending on that issue's resolution, the fix will have to be applied here as well. Regardless, the patch is still ready for testing and feedback.
Comment #14
cpliakas commentedAdded cleanup routine in
hook_apachesolr_environment_delete()that removes the environment specific settings on delete.Comment #15
cpliakas commentedBased on the resolution of the issue #1379166: The Current Search Block is displayed on the search page even when no search has been executed, there is nothing more that needs to be added to the patch in #14. The functionality could technically be implemented in another contrib project, but the changes to the ApacheSolrFacetapiAdapter::getSearchPath() would still need to be applied to prevent fatal errors.
Comment #16
nick_vhWhy does the unset happen here?
Other then this it seems to be ok. Still have to test it though :-)
Comment #17
cpliakas commentedIt happens because the variable is an array of settings keyed by environment ID. If we didn't have this cleanup routine when the environment was deleted, the settings would still remain in the array for an environment that no longer exists. This isn't too much of an issue because there is enough defensive coding that would prevent the empty query from running, however the application would still try. If an environment with the same name was created again, the settings would be active for it which might not be the intended behavior.
Talking through this just now, would the
apachesolr_environment_variabletable be the best place to store these values? I stuck with the core variables table to have something that is fast, loaded on every page load anyways, and it prevents us from having to load all environments to check whether an empty query should be run.Comment #18
nick_vhI'm not sure about performance difference. The variable get is ok but it is an extra thing to take care of when updating or uninstalling. I guess it does make sense to add it to the environment settings. This is cached and is a static variable so it probably does not hurt the performance a lot.
Maybe we should test it with apachesort benchmark? Fire up 1000 requests with variable_get, 1000 with the other one and see how fast it loads?
Comment #19
cpliakas commentedI think that makes sense. Looking through the code,
apachesolr_load_all_environments()is currently NOT called on non-search pages, which is a good thing. If we did want to store the variables in theapachesolr_environment_variabletable then we would have to callapachesolr_load_all_environments()on every page load. This data is cached and in a static like you said so it probably wouldn't be too much of a performance hit.Comment #20
nick_vhThe results of the benchmark with the patch from cpliakas. Facets were added on a regular page with some bullshit content. No extra modules included.
Will try to change the patch now so it uses the apachesolr_environment_variables and see if it makes significant difference. I suppose we should test it with logged in users also? As mentioned here : http://www.midwesternmac.com/blogs/jeff-geerling/using-apachebench-ab-dr...
notes : no page caching was enabled, query cache for solr was enabled.
Nick-Veenhofs-MacBook-Pro:apachesolr nickveenhof$ ab -c1 -n500 http://apachesolrissues.dev/content/test-utf8
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking apachesolrissues.dev (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: Apache/2.2.20
Server Hostname: apachesolrissues.dev
Server Port: 80
Document Path: /content/test-utf8
Document Length: 25000 bytes
Concurrency Level: 1
Time taken for tests: 183.454 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 12766500 bytes
HTML transferred: 12500000 bytes
Requests per second: 2.73 [#/sec] (mean)
Time per request: 366.908 [ms] (mean)
Time per request: 366.908 [ms] (mean, across all concurrent requests)
Transfer rate: 67.96 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 327 367 20.3 361 427
Waiting: 304 343 20.1 337 401
Total: 327 367 20.3 361 427
Percentage of the requests served within a certain time (ms)
50% 361
66% 380
75% 386
80% 388
90% 393
95% 400
98% 408
99% 413
100% 427 (longest request)
Comment #21
nick_vhWhile I was trying to change this I actually noticed with your patch it is possible to show facets of multiple environments. I guess we should stick to "keep it simple" and only support the default environment for output. It will get very complex I suppose to figure out the correct page where the facet should go to? Working on a patch right now that reduces this complexity
Comment #22
nick_vhNick-Veenhofs-MacBook-Pro:facetapi nickveenhof$ ab -c1 -n500 http://apachesolrissues.dev/content/test-utf8
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking apachesolrissues.dev (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: Apache/2.2.20
Server Hostname: apachesolrissues.dev
Server Port: 80
Document Path: /content/test-utf8
Document Length: 25000 bytes
Concurrency Level: 1
Time taken for tests: 184.370 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 12766500 bytes
HTML transferred: 12500000 bytes
Requests per second: 2.71 [#/sec] (mean)
Time per request: 368.741 [ms] (mean)
Time per request: 368.741 [ms] (mean, across all concurrent requests)
Transfer rate: 67.62 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 326 369 32.2 365 844
Waiting: 302 344 31.5 341 820
Total: 326 369 32.2 365 844
Percentage of the requests served within a certain time (ms)
50% 365
66% 370
75% 373
80% 377
90% 391
95% 406
98% 430
99% 503
100% 844 (longest request)
With attached patch (apachesolr_environment_variable_get())
I also feel this patch is a bit cleaner. It might also impact performance since not every environment is looped now at page load
Comment #23
cpliakas commentedThanks for the benchmark tests, Nick! Excellent, quick work as always.
The reason why I added support for multiple environments is because of Peter's comment in #8 above. The original patch actually only worked with the default environment so we are coing a bit full circle. I am definitely OK with that, just want to make sure everyone is on board.
Comment #24
nick_vhI just replaced the first benchmark because it was not correct
patch #14 Time per request: 366.908 [ms] (mean)
patch #22 Time per request: 368.741 [ms] (mean)
Mine is a bit slower
I did not really read the full issue, my bad! So I guess for the pages we probably need to load all the environments and loop over those variables if we want to keep it sane?
#8 only mentions that we are coupling it to a specific environment. It did not mention we have to support all the environments at once. My latest patch fetches the default environment and checks the settings of that one. If someone is smart enough he/she would probably make a custom module and make a hook_init for their second or whatever environment and point it to a specific page.
If someone switches from default environment their configurations will also change. At least it is a step in the correct direction I guess. I'm not a big fan of the 'looping over all enviroments approach' because it could end up in an unwanted mess and maybe even in "1 multiplied with the amount of environments" solr queries per page load where the facets are shown.
Comment #25
cpliakas commentedYup. New Year's resolution, read issues more thoroughly.
I can definitely see that.
Regarding the benchmarks, 2ms is definitely not that much, and I think with the simplicity you proposed it is warranted.
I ran the patch and I cannot seem to save the settings. I think it is because the settings are no longer arrays keyed by environment ID, but in some instances that still seems to be present.
Thanks for your detailed reviews,
Chris
Comment #26
cpliakas commentedAttached is a revised patch. I also attached an interdiff to show the changed between #26 and #22.
Comment #27
cpliakas commentedComment #28
nick_vhCommitted! This was a great commit before 2012 started!
Comment #29
cpliakas commentedThanks again for your feedback and testing. A couple of people have asked for this, so having it available OOB is a great option especially for e-commerce sites!
Comment #30
nick_vhComment #31
nick_vhComment #32
drewmacphee commentedThis doesn't seem to work correctly in a multi-environment setup. It only seems to show the first environments facets, none of the other environments facets show up.