Unable to access several pages without starting solr server.
In solr with default settings, it gives RSolr error which redirect us to a error page because of there is no any solr instance up and running. There should be a way to avoid this error massage and run the project without solr errors. Yes, obviously solr search won't work without a solr connection. But all other pages should work properly.

My observation :
As a initial step, we index fields in a model (this fields can be a direct database column or custom method which returns a value from combination of database columns). When we start to run the rails project and we access a page which contains a field that we indexed earlier, rails server automatically search for a solr connection to connect to the solr database for retrieve the value (most of the time this value is the primary key (id) of the particular record).
Suggested solution :
I'm trying to figure out the line where make this call to solr and handle this exception by overriding that particular line of code. Otherwise we can dig into the sunspot_rails gem and find appropriate configuration or make custom configuration against this this call.
Great. Is it possible to do it either in the Search class you've created (to modularize all search functionality) or by creating a wrapper around Solr? Are there examples of doing this already out there, maybe on Stack Overflow?
Thanks, Ujitha!
On Sun, Jul 31, 2016 at 6:22 AM, Ujitha Perera [email protected] wrote:
In solr with default settings, it gives RSolr error which redirect us to a error page because of there is no any solr instance up and running. There should be a way to avoid this error massage and run the project without solr errors. Yes, obviously solr search won't work without a solr connection. But all other pages should work properly.
[image: screen shot 2016-07-31 at 3 24 04 pm] https://cloud.githubusercontent.com/assets/12997101/17275856/71b8bcdc-5734-11e6-851e-dd2cd2f6a04c.png
My observation :
As a initial step, we index fields in a model (this fields can be a direct database column or custom method which returns a value from combination of database columns). When we start to run the rails project and we access a page which contains a field that we indexed earlier, rails server automatically search for a solr connection to connect to the solr database for retrieve the value (most of the time this value is the primary key (id) of the particular record).
Suggested solution :
I'm trying to figure out the line where make this call to solr and handle this exception by overriding that particular line of code. Otherwise we can dig into the sunspot_rails gem and find appropriate configuration or make custom configuration against this this call.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ93B_lzYmDwmuWG8SFZEuUBzR6Thks5qbHdlgaJpZM4JZAKd .
Yes searched in stackOverflow also. I found few answers and I tried them. but still this issue exists. when we mention, steps to run solr server as installations steps, he/she can follow this steps and avoid this error. In that perspective this is not going to be an issue anymore. what do you think @jywarren ?
I think it adds a significant additional step to initial installation which we should try to make optional if it's not too much trouble. For example, if you could ask another student to try installing Solr, to see how easy it is, using your instructions, that's helpful info.
Can you trace where this request is being made? On the save method, but how does Solr intercept the save method, and can we make that configuration settable, optional?
Okay, then I can deliver information about solr under different topic. Let's say 'For solr advanced search (optional)' .
yes we have to trace all the callbacks and incoming parameters. Then let me double check again to find a clue to proceed with
Where is Solr actually activated, and where do you 'make it aware' of the different models to index? That's the place to start. Great!
On Tue, Aug 2, 2016 at 1:31 PM, Ujitha Perera [email protected] wrote:
Okay, then I can deliver information about solr under different topic. Let's say 'For solr advanced search (optional)' .
yes we have to trace all the callbacks and incoming parameters. Then let me double check again to find a clue to proceed with
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-236979617, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ1UR6uJr8_WJYeky80LoM0GRr0Tyks5qb377gaJpZM4JZAKd .
I've been pondering this, and it occurs to me that we may be able to add a section to the Gemfile that specifically deals with solr. Then, as with the --without production, --without test, etc. users can install and skip these additional requirements.
Thoughts?
Ah, that would be fantastic. If we don't include the gems when we bundle install, is there nowhere else in the code we need to "switch off" solr?
On Tue, Aug 2, 2016 at 3:27 PM, david-days [email protected] wrote:
I've been pondering this, and it occurs to me that we may be able to add a section to the Gemfile that specifically deals with solr. Then, as with the --without production, --without test, etc. users can install and skip these additional requirements.
Thoughts?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-237015890, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJwWWSNO9dShd_NR0804KKpZV9Fn3ks5qb5oggaJpZM4JZAKd .
Well, without any other mitigation, the first effect would be that the functions that use solr (perhaps restricted to advanced search) would simply fail. If a developer is working on location data (or rich editor, or internationalization, or anything that doesn't use advanced search), this would remove the overhead of solr with the understanding that the certain functionality would not be available.
Alternatively, we could mitigate this with some code that performs try-catch regarding the solr calls. In that case, dev/test/production would get a reminder "Is solr running?". This might be the best way to go, and would also be a good way to localize any operational issues in production. For example, on search-result returns (since we have a wrapper class to encapsulate the document data), a placeholder for an error result could be returned for a subsystem. That way, one of the return results would be a fake "document" link saying "Solr was not accessible" and some details to point the sysadmin (in this case, you, Jeff) to the underlying issue...while being secure enough not to give a hacker a pointer to a vulnerability.
I'd love try/catches, as an optimal solution. If we don't include the solr gems, tests will fail, right?
Thanks!
On Aug 2, 2016 4:34 PM, "david-days" [email protected] wrote:
Well, without any other mitigation, the first effect would be that the functions that use solr (perhaps restricted to advanced search) would simply fail. If a developer is working on location data (or rich editor, or internationalization, or anything that doesn't use advanced search), this would remove the overhead of solr with the understanding that the certain functionality would not be available.
Alternatively, we could mitigate this with some code that performs try-catch regarding the solr calls. In that case, dev/test/production would get a reminder "Is solr running?".
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-237034824, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ7W-ngOU-VvfMkUDq0bI-09yCuhoks5qb6nmgaJpZM4JZAKd .
I'm still new to Ruby testing (and that's part of the reason this last PR is taking so long), but it looks like you can set environmental values in the application, install, or runtime to handle test exclusions, as per this page.
It's an extra couple of steps for the installation process, but I think it would work. Simply have the group :solrinstall set an environment variable somewhere, and the testing runtime will check that before the solr tests. It's getting into the weeds a bit, but it could cover all the bases.
Oh, that makes sense and is a relief to hear. It can be a challenge to balance high level features with ease of installation, and I hope we don't have to bend over backwards to find a compromise.
Thanks!
On Aug 2, 2016 10:39 PM, "david-days" [email protected] wrote:
I'm still new to Ruby testing (and that's part of the reason this last PR is taking so long), but it looks like you can set environmental values in the application, install, or runtime to handle test exclusions, as per this page http://jasontruluck.org/blog/testing/rspec/tricks/2013/06/06/Conditional-Exclusion-In-Rspec.html.
It's an extra couple of steps for the installation process, but I think it would work. Simply have the group :solrinstall set an environment variable somewhere, and the testing runtime will check that before the solr tests. It's getting into the weeds a bit, but it could cover all the bases.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-237117708, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ5A_tn-un98JUcNvZVoVg8gQX6RDks5qb_9-gaJpZM4JZAKd .
I will try to work with Ujitha on this step--he knows the install process for solr, and I can help with a bit of guidance if he needs it regarding where to put the test exclusion code. We'll also add relevant sections to the install instructions on the README.md, as well.
+100000000 thanks all!
On Aug 2, 2016 11:52 PM, "david-days" [email protected] wrote:
I will try to work with Ujitha on this step--he knows the install process for solr, and I can help with a bit of guidance if he needs it regarding where to put the test exclusion code. We'll also add relevant sections to the install instructions on the README.md, as well.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-237129344, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJw-OZh8BC-2llZwNe-o0mg4Z6OT9ks5qcBCMgaJpZM4JZAKd .
Thank you very much @david-days. I totally forgot this basic Gemfile configurations. This is a great solution for this kind of new implementations. You saved me.
@jywarren Thank you for being helpful. i really appreciate
Not a problem--it's something I'm learning with respect to Ruby, but I've used this kind of mechanism many times over the years (httpd, Tomcat, IIS, C#, etc), so it was just a matter of finding out how Ruby/Rails does the same thing.
Yeah ! Thank you for sharing your experiences with me. I always learn something new from you.
@jywarren this issue is still exists in our solr implementation. @david-days and me are working on this. can you please hold PR #652 until we post a fix.
Yep!
On Aug 10, 2016 4:37 PM, "Ujitha Perera" [email protected] wrote:
@jywarren https://github.com/jywarren this issue is still exists in our solr implementation. @david-days https://github.com/david-days and me are are working on this. can you please hold PR #652 https://github.com/publiclab/plots2/pull/652 until we post a fix.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-238906660, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ9nmz7fiRKpbeD4ENWIFwFttQSPbks5qefAbgaJpZM4JZAKd .
@jywarren ,
Ujitha and I have been through the code and the setup for solr and plots2 with a fine-toothed comb, and I believe that the easiest and best solution for this issue is what Ujitha originally proposed--adding the solr installation and run commands to the PLOTS2 README.md. This would simply add a small section to the setup process and one command to the installation/run section of the guide.
We've tried other avenues of getting around this, and come up against several issues that would make maintenance, installation, and testing more difficult:
- The first issue is that solr provides a lot more information to, and is more tightly integrated with, the plots2 code than I originally understood. Once the solr process is running, it also indexes against the user, and this information is used as part of the search process. If we tried "skipping" the solr installation, then a lot of code would have to be put it to get around these data gaps--this ends up being a maintenance nightmare for follow-on coders and testers.
Ujitha knows this in more detail than I do, but I'm convinced that it's worth having solr running. Alternatively, if we just don't use that part of solr, we are also missing a lot of the search capabilities that the system provides. Kind of like buying a car so you can use it as a paperweight... In our case, the "buying price" is just a couple of steps in the installation/setup/run, so it's worth using this extra information, and it provides a lot of the profile search requirements that we have discussed over the last few months.
- My idea of testing conditionals and environment variables didn't pan out--what you actually end up with is a more complicated testing system, wherein you have to specifically include or exclude calls manually. I thought that it could be automated from the "--without XXX" arguments, but this doesn't work to the degree that I thought it would. Even if we got it running, we are still left with the problems of #1.
- Finally, we looked at just quietly integration the startup of solr with the normal app startup. It may be possible, but my limited understanding of the passenger system is that it is purposefully designed to start one application at a time. You can start multiple instances of a single app, but I'm guessing that trying to start a suite of apps goes against the grain of the Linux and passenger design concepts.
While someone may be able to figure this out, my conclusion is that doing so at this point would be error prone, as well as a maintenance issue that would not be reasonable for a production environment.
I realize that it is extra work to include the solr setup/run process in the main process, but I believe that any alternative to this adds complications that we would rather avoid. Ujitha has investigated the reliability of the sunspot_solr engine, and I agree with him that it is mature and stable enough to include it in the setup instructions with little difficulty.
Ok, I will try following the new instructions early next week on my ARM7 laptop, but not sure how smoothly that'll go. In the meantime we should see how easy it is to install by asking some other students to try it out. Thanks for looking into this!
On Aug 11, 2016 6:13 PM, "David C Days" [email protected] wrote:
@jywarren https://github.com/jywarren ,
Ujitha and I have been through the code and the setup for solr and plots2 with a fine-toothed comb, and I believe that the easiest and best solution for this issue is what Ujitha originally proposed--adding the solr installation and run commands to the PLOTS2 README.md. This would simply add a small section to the setup process and one command to the installation/run section of the guide.
We've tried other avenues of getting around this, and come up against several issues that would make maintenance, installation, and testing more difficult:
- The first issue is that solr provides a lot more information to, and is more tightly integrated with, the plots2 code than I originally understood. Once the solr process is running, it also indexes against the user, and this information is used as part of the search process. If we tried "skipping" the solr installation, then a lot of code would have to be put it to get around these data gaps--this ends up being a maintenance nightmare for follow-on coders and testers.
Ujitha knows this in more detail than I do, but I'm convinced that it's worth having solr running. Alternatively, if we just don't use that part of solr, we are also missing a lot of the search capabilities that the system provides. Kind of like buying a car so you can use it as a paperweight... In our case, the "buying price" is just a couple of steps in the installation/setup/run, so it's worth using this extra information, and it provides a lot of the profile search requirements that we have discussed over the last few months.
My idea of testing conditionals and environment variables didn't pan out--what you actually end up with is a more complicated testing system, wherein you have to specifically include or exclude calls manually. I thought that it could be automated from the "--without XXX" arguments, but this doesn't work to the degree that I thought it would. Even if we got it running, we are still left with the problems of #1 https://github.com/publiclab/plots2/issues/1. 2.
Finally, we looked at just quietly integration the startup of solr with the normal app startup. It may be possible, but my limited understanding of the passenger system is that it is purposefully designed to start one application at a time. You can start multiple instances of a single app, but I'm guessing that trying to start a suite of apps goes against the grain of the Linux and passenger design concepts.
While someone may be able to figure this out, my conclusion is that doing so at this point would be error prone, as well as a maintenance issue that would not be reasonable for a production environment.
I realize that it is extra work to include the solr setup/run process in the main process, but I believe that any alternative to this adds complications that we would rather avoid. Ujitha has investigated the reliability of the sunspot_solr engine, and I agree with him that it is mature and stable enough to include it in the setup instructions with little difficulty.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/642#issuecomment-239227150, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ6oi-KuOzWfLHHJYlJER8OzjPRolks5qe1hGgaJpZM4JZAKd .