Thursday, September 29, 2011

Running Thinking Sphinx in two applications

Here i'm gonna explain you how to run thinking sphinx in two applications.
Solved Answer: thinking sphinx undefined local variable
Solution for " thinking sphinx undefined local variable "
Answer: This can be done by running thinking sphinx server on two ports
for example: you have two rails applications on your server.
now by default thinking sphinx runs on port 9312

step 1: stop thinking sphinx server if running on first application by typing " rake ts:stop " in your           terminal.
step 2: go to first application folder and delete the files " development.sphinx.conf, test.sphinx.conf and production.sphinx.conf " which are in config folder.
step 3: find the file named sphinx.yml in same config folder, if it doesn't exist create new file with name   " sphinx.yml "
step 4: edit the file sphinx.yml, place this below code in it.
#################################################################################
development:
  port: 9313
test:
  port: 9314
production:
  port: 9315
#################################################################################
IMPORTANT NOTE: SPACE BEFORE THE WORD PORT SHOULD BE TWO SPACES, IF NOT IT DOESN'T WORK.

step 5: now open terminal and go to your application folder and type " rake ts:config "
           thinking sphinx will create new file
           " development.sphinx.conf "
           ( if you have done indexing for testing and production mode then those two files will also be created. )
           you can check that file where you can see in line no 7
           " listen = 127.0.0.1:9313 "
           listen port will be same as you assigned in sphinx.yml file.
step 6: do the same procedure for second application but with different port numbers
           for example:
#################################################################################
           development:
             port: 9316
           test:
             port: 9317
           production:
             port: 9318
#################################################################################
step 7: now start your rails applications on different ports ( i.e ex: " rails s -p 4000 " )
           and thinking sphinx servers on both applications ( rake ts:start )

thats it.

was this helpfull please let me know if you have queries.
please post comments and let me know some feedback.








No comments:

Post a Comment