Thank you in advance for bearing with me. I am new to Solr and looking to integrate into Rails. Although Postgres can text search, Solr seems to be faster..
I understand the modifications that need to happen to the models and controllers within the Rails app itself, however, I cannot seem to grasp when the xml files themselves will be defined and/or stored. Is there a configuration which points to a data source/xml file within Rails that I am missing? I understand that Solr runs and is launched right from the Sunspot gem, but how does that data source (in my case, xml files) communicate with the app? I am not sure if I understand how localhost:8983/solr is to interact with Rails as is would normally.
Any and all help is appreciated, many many thanks. I am running lion 10.7, ruby 1.9.7, rails 3.2.9, the sunspot gem... THANK YOU!
Not sure if I'm answering all of your questions, but when you run the command:
rails generate sunspot_rails:install
it generates a file in the config directory called sunspot.yml. In that file, it specifies how to connect with a running SOLR database depending on your environment.
The Sunspot gem then looks at that file in order to know how to connect to SOLR.
Related
I am new to rails and ruby and I wanted to make a small web app using a rails backend (not a good idea considering I am new to both). I am trying to conceptualize the folder structure of rails, and I am confused whether there is a file that runs everything in the folder.. or how does it work? I've used node.js and django (python) and usually I'll have a server file that imports my database and such, but with this rails setup--I am a bit overwhelmed. Any help would be great!
In your rails app, there is no one file that requires and runs all other files. There are a couple of files that do something like this, but they don't load everything.
Instead, rails knows where to look for information when it boots your app. Your database configuration goes to config/database.yml. Boot-time setup goes to config/initializers/. And so on. As a rails dev, you're expected to know this. Convention over configuration, they call it.
A good rails book can help with learning these conventions (what goes where).
I have a thinking-sphinx app and oddly enough the files in /db/sphinx/development/ have not been initialized.
I have a separate app where they HAVE been, but I am not sure why. I don't recall doing anything different.
Does anyone know how to create these files or if they are app specific?
The directory db/sphinx/development usually contains the sphinx index on your development machine, if you have built it. You can do this in ThinkingSphinx by creating your configuration file with rake ts:conf, afterwards you can generate the Sphinx index with rake ts:index. Sphinx need to be installed correctly on your machine, of course.
Ok, long time php guy doing my best to pick up ruby on rails by developing a small website for myself using only ror instead of php.
However i'm a bit stuck, and i think it is because i'm not exactly understanding how rails actually works.
I am running centos 5.5 / apache2. I have successfully installed ruby, rubygems, and subsequently rails and passenger. All these are 'working', i can run ruby commands, gem commands etc.
But how do I start using rails on my website? If I create an .erb or .rb file with some simple ruby commands, it just displays as plain text when I navigate to it.
Do I need to configure apache to 'execute' .rb or .erb files (similar to the way .php files execute?).
Any help would be GREATLY appreciated!!
You might check out the Rails Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
I suggest you read a huge tutorial on this topic: http://guides.rubyonrails.org/getting_started.html.
Ruby is the language, and Ruby on Rails is a framework. From the guide:
Rails is a web application development
framework written in the Ruby
language. It is designed to make
programming web applications easier by
making assumptions about what every
developer needs to get started. It
allows you to write less code while
accomplishing more than many other
languages and frameworks. Experienced
Rails developers also report that it
makes web application development more
fun.
I'd read Chapter 4, if you already know all this, as it talks about the actual webserver.
Rails comes with it's own webserver, so Apache isn't needed.
Sounds like you need to really get a handle on Rails and what it is first. This site has some great information for beginners, and should help you understand what you are working with and your next steps to get an application running:
http://guides.rubyonrails.org/getting_started.html
I've also heard some good things about the information here:
http://railsforzombies.org/
Check out Ruby on Rails Tutorial for getting started in Rails.
As #Blender mentioned, rails comes with an in build web server called webrick. (Think of it same as apache .. for now)
so all you have to do is go to the rails project directory, and run the command
if you are using rails < 3.x
ruby script/server
if you are using rails > 3.x
rails server
once u done this your rails project will start in webrick server and by default in port 3000
http://localhost:3000
you may consider apache/ some other rails server setup for production deployment, but to get started you dont need apache at all
and welcome to ruby world ! :D
HTH
sameera
I just look up at rails sources and find folder named "dispatches". There is four file in it. I want to know purpose of this files. I know I use this files on my production server, but I never used to think of their purpose. I know there is something about attaching Rails app to Apache server. On my production server rails appname command add this files to public folder automatically. Can I set up this behavior on my development machine?
The rails dispatcher is the entry point for a rails application and is used to bootstrap the environment.
They have a long history and in a lot of ways they are almost obsolete. In days gone by rails apps used to be powered using cgi or fastcgi, which was a way for the webserver to communicate with a rails process. The boot process would be initiated by dispatch.fcgi or dispatch.cgi. Nowadays people are more likely to use apache/nginx+passenger or apache/nginx+mongrel/thin. (Does anyone still use lighttpd?)
I'm a little fuzzy on how dispatch.rb is used, but I think it's used by upstream rails servers such as mongrel/thin to bootstrap the rails process. However, now that rails is rack compatible I'm not entirely sure if that has changed.
You don't need to pay the dispatch.* files any attention.
I hope this helps.
Yesterday I was trying to install Sphinx for full-text search on Windows 7. So, I followed their website's installation steps.
Once I installed its windows service, I ran the indexer and then the test search against my app database and it worked great.
Then, I wanted to make it work on Ruby on Rails 2.3.2, so I downloaded and installed the thinking-sphinx plugin. I followed these steps, creating the sphinx.conf file at the config directory of my app, and then I ran the rake thinking-sphinx:indexer and it worked great. After that, when I wanted to start it, as it's explained in that guide, it didn't start...it just keep saying "thinking-sphinx:start", and it didn't either stop or start.
What am I doing wrong?
Thanks,
Brian
Well, it seems that without starting it using rake it works anyway...it's maybe because the Sphinx service is already started, so you don't need to start it also with the rake from ruby.
I've got another doubt now...I'm from Argentina and we use accents to write in some words...for example "acción", which means "action" in english. I tried searching that word without the accent(people don't ussually write accents on searches) and it didn't bring any results, but if I search it with the accent, it will bring results.
How can I fix that?
Thanks,
Brian