Yes, unless you pass :populate => true, TS will only load results when you need them (which allows for chaining sphinx scopes without querying Sphinx multiple times).
Good to know it's working. -- Pat On 29/10/2011, at 5:33 AM, Jawad Rashid wrote: > Never mind i have resolved the problem myself. I was actually first > trying to debug that i was getting any results or not in my controller > action by using command of search in the action and then using > render :nothing => true as i only wanted to check validity of Sphinx > search and the problem was Thinking Sphinx was not searching until i > use the variable which has the results for Sphinx search in a view. > Now i have changed my code to render a .js.erb file in response to an > ajax call and i use the result in the view and the results are > showing. I guess Thiking Sphinx only searches Sphinx when the variable > is being used in a view. > > On Oct 28, 1:14 pm, Jawad Rashid <[email protected]> wrote: >> I am using passenger/nginx on my server. I have declared nginx >> configuration and activated passenger support in there. So everytime i >> execute a script to start nginx. In my controller i have declared >> Recipe.search "Recipe" and used puts to output it in log file but >> nothing appears either in development log of the search query, >> development log of application or nginx errors log. I am currently not >> using the search results directly in my view i am currently only using >> puts command in my controller and if i get results in the log file >> then i will use the search results directly in my view. >> >> On Oct 28, 8:29 am, Pat Allan <[email protected]> wrote: >> >> >> >> >> >> >> >>> Hi Jawad >> >>> How are you running the server? Via 'script/rails server', or Passenger, or >>> something else? Are you seeing anything in the development log for the >>> search query? How are you using the search results in your views? >> >>> Cheers >> >>> -- >>> Pat >> >>> On 26/10/2011, at 11:12 AM, Jawad Rashid wrote: >> >>>> Yes the query works on rails console but not on the application. >>>> The query i am using is: >> >>>> Recipe.search "Recipe" >>>> and i have also tried >>>> ThinkingSphinx.search "Recipe" >> >>>> for both cases i get the correct results in the application console >>>> but when i use it in a controller action for Recipe i get no results >>>> at all. Not even a warning or error in my log files for server or >>>> development log. Plus, when using these commands on the console i do >>>> get entry in the searchd.query.log but there is no entry when using in >>>> application. >> >>>> On Oct 26, 3:06 am, Pat Allan <[email protected]> wrote: >>>>> Hi Jawad >> >>>>> Thanks for all the detail, it all looks correct. I just want to clarify: >>>>> it works in console, but not through a browser/application? What is the >>>>> query you're using for testing? >> >>>>> -- >>>>> Pat >> >>>>> On 25/10/2011, at 9:21 PM, Jawad Rashid wrote: >> >>>>>> I am currently have installed sphinx and using thinking >>>>>> sphinx v2.0.5. Currently i am using rails 3.0.7 and ruby 1.9.2-p180. >>>>>> I am using sphinx 0.9.9. I have followed instructions on thinking >>>>>> sphinx and after fixing some problems was able to install sphinx using >>>>>> source and it was successful. I have set up indexes on on my model >>>>>> file name "Recipe" on a simple db column recipeName of type string. I >>>>>> am using phusion passenger server. Right now i am working on >>>>>> development server. >>>>>> This is the index i have defined in my model file: >> >>>>>> define_index do >>>>>> indexes :recipeName >>>>>> end >> >>>>>> After this i have started the rake task for generating configure,then >>>>>> rake task for build index and started the rake task for searchd >>>>>> daemon. >> >>>>>> Now the problem is i am able to search from the database using rails/ >>>>>> console by using command: >> >>>>>> Recipe.search "Query" >> >>>>>> and i do get results. I then also tried a command to search from the >>>>>> application directory and i again got results. The problem is when i >>>>>> used the same query of >> >>>>>> Recipe.search "Query" >> >>>>>> i got no results...actually nothing happens...i don't even get an >>>>>> error from my development log or nginx error file. >>>>>> I noticed then when i use the command form rails/console i do get an >>>>>> entry in searchd.query.log file but when i use the same command from >>>>>> one of controller action there is no entry in this log file which >>>>>> tells me that even the call is not going to the searchd daemon. >> >>>>>> The only configuration file for sphinx is config/ >>>>>> development.sphinx.conf and i can't find any problem. This file was >>>>>> automatically created when i use index rake task. I have not declared >>>>>> any configuration for sphinx. Here is the configuration file...i have >>>>>> intentionally commented out username and password: >> >>>>>> indexer >>>>>> { >>>>>> } >> >>>>>> searchd >>>>>> { >>>>>> listen = 127.0.0.1:9312 >>>>>> log = /Users/jawadrashid/RecipeProject/log/searchd.log >>>>>> query_log = /Users/jawadrashid/RecipeProject/log/searchd.query.log >>>>>> pid_file = /Users/jawadrashid/RecipeProject/log/ >>>>>> searchd.development.pid >>>>>> } >> >>>>>> source recipe_core_0 >>>>>> { >>>>>> type = mysql >>>>>> sql_host = localhost >>>>>> sql_user = ********** >>>>>> sql_pass = ********* >>>>>> sql_db = RecipeProject_dev >>>>>> sql_query_pre = SET NAMES utf8 >>>>>> sql_query_pre = SET TIME_ZONE = '+0:00' >>>>>> sql_query = SELECT SQL_NO_CACHE `recipes`.`id` * CAST(1 AS SIGNED) + >>>>>> 0 AS `id` , `recipes`.`recipeName` AS `recipeName`, `recipes`.`id` AS >>>>>> `sphinx_internal_id`, 0 AS `sphinx_deleted`, 3710170113 AS `class_crc` >>>>>> FROM `recipes` WHERE (`recipes`.`id` >= $start AND `recipes`.`id` <= >>>>>> $end) GROUP BY `recipes`.`id`, `recipes`.`recipeName`, `recipes`.`id` >>>>>> ORDER BY NULL >>>>>> sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) >>>>>> FROM `recipes` >>>>>> sql_attr_uint = sphinx_internal_id >>>>>> sql_attr_uint = sphinx_deleted >>>>>> sql_attr_uint = class_crc >>>>>> sql_query_info = SELECT * FROM `recipes` WHERE `id` = (($id - 0) / >>>>>> 1) >>>>>> } >> >>>>>> index recipe_core >>>>>> { >>>>>> source = recipe_core_0 >>>>>> path = /Users/jawadrashid/RecipeProject/db/sphinx/development/ >>>>>> recipe_core >>>>>> charset_type = utf-8 >>>>>> } >> >>>>>> index recipe >>>>>> { >>>>>> type = distributed >>>>>> local = recipe_core >>>>>> } >> >>>>>> I don't know what is the problem. I have tried many things by >>>>>> following common problems and solutions on google but i am not able to >>>>>> understand what i am doing wrong as i am getting results from rails >>>>>> console but not from any controller action. >> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Thinking Sphinx" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group >>>>>> athttp://groups.google.com/group/thinking-sphinx?hl=en. >> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Thinking Sphinx" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group >>>> athttp://groups.google.com/group/thinking-sphinx?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
