Grails and Solr - grails

I'm doing this project, in which i need to create a more powerfull GUI for apache solr https://lucene.apache.org/solr. I'm doing it with Grails, and basically, I just need to create a GUI which will manipulate solr url's and get me the results I need. The way im seing this, I can have my project Grails running at same time as Solr, nothing new here. But I would like to do it, but only have 1 server running. Is there any way to do this with Grails?

This may be a bit late, but in case it helps someone else I'm adding my $.02.
Look at SolrJ for the java API to communicate from grails/groovy/java to a separate solr instance. It's quite easy, and once you get your head wrapped around using Solr's NamedLists for response info, you should have no trouble.
Mats Lindh has some further information on solrj:
http://e-mats.org/2008/04/using-solrj-a-short-guide-to-getting-started-with-solrj/

The Solr plugin embeds an instance of Solr - http://www.grails.org/plugin/solr - This might not be the best way for production, but it might be a good place to start.

Related

Can I use my web server to host my rails application?

I have now build my first Ruby on Rails site and I want to publish/deploy/show it to the world on internet. I have access to space on a web server trough a university that I am associated with. But after some searching I realized that publishing a Rails site is slightly more complicated than publishing a regular html production.
Is there any way to use the space I have? How can I know if the server I have access to is up for the task? Is there any guides on how to do this via SSH or git or whatever? I have search a lot but not found anything useful. It doesn't have to be easy, I just have to work. And it's good if I can learn and understand what I am doing.
I have tried quite extensively to make it work with Heroku (everybody claims it to be so easy) but failed since it will not accept my push. Probably because I use Rails 4.2.2 (I don't want to change this, too many things stopped working when I tried to update) and Paperclip which seems to be known issues.
Please, I'm getting desperate, any help pointing in the right direction is very appreciated.

Simplest way for understanding MongoDB iphone

What is the simplest way of understanding about mongoDB? i know there's something called as NuMongo wrapper to to interact with mongoDB, but yet its not yet clear in my head. Can some please share the knowledge ?
Thanks
Directly accessing a MongoDB database from a mobile device is probably not a good idea. The main limitation is that the Mongo wire protocol has no encryption.
You can build an application server as middleware, in almost any language you like.
That said, ObjCMongoDB (of which I'm author) has support for iOS, so if you decide you want to give it a go anyway, you can.
If you want to write an application server on Mac OS using Objective-C, you can also use ObjCMongoDB for that, along with something like CocoaHTTPServer.
An very simple way is to set up a Rails Application with some mongoDB PlugIn, e.g. mongomapper and in Rails you can define the web service to communicate with the iPhone.
These links are very good to understand Rails and mongomapper:
Rails Guides
MongoMapper Documentation

Is it possible to use DataImportHandler in Sunspot Rails?

I have a rails app which has data in MySQL db. I am using Sunspot to interact with Solr and I would like to be able to use DataImportHandler to import data from MySQL to Solr. I have tried searching on google and I can't seem to find an answer to my question.
Ultimately, I want to be able to create a rake task that will do this data import.
The idea is interesting, but the answer is no. You would have to create your own custom data-config.xml. That said, so long as you stick to Sunspot field naming conventions, you should still be able to use Sunspot for searching with such a setup.
Generation of that data-config.xml from Sunspot's configuration would definitely be an interesting addition. Maybe for a future version.

Grails handling FTP dump

I have a site where users are uploading files with a form and it posts and its great, but one customer insists on using FTP instead. I have determined three options for handling this, and I was wondering if anyone has any insight on which is best (or if there is a different overflow I should be asking this on), or if there is a fourth better option.
Solution 1: Learn Linux. I could probably write a cron job that looks in the directory to which they're uploading every 5 minutes and then post the files it finds into my site.
Solution 2: Create a timer driven service in grails that looks in the directory every 5 minutes. This is what I'm going to start trying.
Solution 3: This would be hard, but I'm sure it would be possible to have grails pretend to be a FTP server allowing the ftp dump to be like a post. I have no idea where to start this solution, so unless there is a plugin this isn't happening.
You can use the Grails Quartz plug-in to schedule a task, if you want to pursue option two in your list.
I would go for option 2 and use the Quartz plugin as suggested (rather than cron). Handling files in Groovy are simple and you have lots of examples such as this from mrhaki.
If you think the processing of files will have more complex requirements you could try out something like Apache Camel with this example from the same mrhaki. Though I believe Spring has its own framework that may be a better fit, you'll have to investigate that yourself if you go down that road.
Grails is a web framework so options 2 and 3 are less than ideal. If having the file that is ftped immediately available in your application option 1 is the quickest and simplest solution of the 3 I think.
Another option is to find an open source FTP server (there are several) and modify it to import the document into your system directly. This will allow your client to use the protocol they prefer (FTP) and still get the file into your application in real time.
Still another option is to provide an FTP like client that will use your grails application as the server. Whether this is suitable or not depends on why the client insists on using FTP which you should determine up front to make sure your solution works for them.

Triggering FireWatir actions from different ruby scripts on the same browser window

I am writing an application that uses FireWatir to do a bunch of different actions. The problem is that I want to trigger these actions from many separate ruby files.
So for example, one ruby script will launch a new FireFox browser instance, than a totally different script will have that instance goto a specific website, and another will log into gmail.
I want all of these scripts to affect the same browser window. That way I can have one script take me to a specific website, and wait for another script to be triggered to do something else.
Please tell me that this is possible.
Chad,
I think that is possible. I am not sure that it's necessary or efficient, but I know that it's possible. The key is to make sure that you attach to the right browser instance. If you will only have one, that could be much simpler.
If you identify the problem that you are trying to solve with these multiple scripts then maybe one or more of the experienced framework designers can point you to existing solutions to the problem. There are some pretty awesome solutions that exist already. At the end of the day, we face the same issues.
Good luck,
Dave
I ended up getting around this issue by using socketing. Had a ruby script acting as the server that was waiting for requests from another group of ruby scripts that could be triggered whenever.

Resources