Sorry, I'm really stuck on both of your issues...

I guess let's take a step back, and compare Sphinx to SQL queries:

  NonProfit.search_count(:with => {:county_id => 2})
  NonProfit.count(:condititions => {:county_id => 2})

What are the values returned by both lines of code?

-- 
Pat

On 05/10/2010, at 7:24 PM, thunderz14enator wrote:

> yes it appears in my searchd.query.log file whein i searchd it gave me
> this result
> 
> [Tue Oct  5 13:51:40.301 2010] 0.000 sec [scan/3/rel 0 (0,20)]
> [non_profit_core,non_profit_delta]
> [Tue Oct  5 13:51:46.358 2010] 0.000 sec [scan/2/rel 14 (0,20)]
> [non_profit_core,non_profit_delta]
> [Tue Oct  5 13:51:47.492 2010] 0.000 sec [scan/3/rel 0 (0,20)]
> [non_profit_core,non_profit_delta]
> 
> On Oct 5, 12:57 pm, Pat Allan <[email protected]> wrote:
>> When you run a search on NonProfit, does it appear in the searchd.query.log 
>> file? Your config file below looks fine.
>> 
>> --
>> Pat
>> 
>> On 04/10/2010, at 11:16 PM, thunderz14enator wrote:
>> 
>>> My development.sphinx.conf looks like this
>> 
>>> indexer
>>> {
>>>  mem_limit = 128M
>>> }
>> 
>>> searchd
>>> {
>>>  listen = 127.0.0.1:9312
>>>  log = /home/pc15/Projects/vivendosdevelopment/log/searchd.log
>>>  query_log = /home/pc15/Projects/vivendosdevelopment/log/
>>> searchd.query.log
>>>  pid_file = /home/pc15/Projects/vivendosdevelopment/log/
>>> searchd.development.pid
>>> }
>> 
>>> source donate_core_0
>>> {
>>>  type = mysql
>>>  sql_host = localhost
>>>  sql_user = root
>>>  sql_pass =
>>>  sql_db = vivendos_development
>>>  sql_query_pre = UPDATE `donates` SET `delta` = 0 WHERE `delta` = 1
>>>  sql_query_pre = SET NAMES utf8
>>>  sql_query_pre = SET TIME_ZONE = '+0:00'
>>>  sql_query = SELECT     SQL_NO_CACHE `donates`.`id` * 2 + 0 AS `id` ,
>>> `donates`.`title` AS `title`, `donates`.`zip` AS `zip`,
>>> `donates`.`description` AS `description`, `events`.`name` AS `name`,
>>> `non_profits`.`nonprofit_name` AS `nonprofit_name`, `donates`.`id` AS
>>> `sphinx_internal_id`, 3658350919 AS `class_crc`, 0 AS
>>> `sphinx_deleted`, `donates`.`county_id` AS `county_id`,
>>> `donates`.`category_id` AS `category_id`, `donates`.`non_profit_id` AS
>>> `non_profit_id`, `donates`.`event_id` AS `event_id` FROM
>>> `donates` LEFT OUTER JOIN `events` ON `events`.`id` =
>>> `donates`.`event_id` LEFT OUTER JOIN `non_profits` ON
>>> `non_profits`.`id` = `donates`.`non_profit_id` WHERE
>>> (`donates`.`id` >= $start AND `donates`.`id` <= $end AND
>>> `donates`.`delta` = 0) GROUP BY  `donates`.`id` ORDER BY  NULL
>>>  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
>>> FROM `donates` WHERE `donates`.`delta` = 0
>>>  sql_attr_uint = sphinx_internal_id
>>>  sql_attr_uint = class_crc
>>>  sql_attr_uint = sphinx_deleted
>>>  sql_attr_uint = county_id
>>>  sql_attr_uint = category_id
>>>  sql_attr_uint = non_profit_id
>>>  sql_attr_uint = event_id
>>>  sql_query_info = SELECT * FROM `donates` WHERE `id` = (($id - 0) /
>>> 2)
>>> }
>> 
>>> index donate_core
>>> {
>>>  source = donate_core_0
>>>  path = /home/pc15/Projects/vivendosdevelopment/db/sphinx/development/
>>> donate_core
>>>  charset_type = utf-8
>>>  min_infix_len = 3
>>>  enable_star = 1
>>> }
>> 
>>> source donate_delta_0 : donate_core_0
>>> {
>>>  type = mysql
>>>  sql_host = localhost
>>>  sql_user = root
>>>  sql_pass =
>>>  sql_db = vivendos_development
>>>  sql_query_pre =
>>>  sql_query_pre = SET NAMES utf8
>>>  sql_query_pre = SET TIME_ZONE = '+0:00'
>>>  sql_query = SELECT     SQL_NO_CACHE `donates`.`id` * 2 + 0 AS `id` ,
>>> `donates`.`title` AS `title`, `donates`.`zip` AS `zip`,
>>> `donates`.`description` AS `description`, `events`.`name` AS `name`,
>>> `non_profits`.`nonprofit_name` AS `nonprofit_name`, `donates`.`id` AS
>>> `sphinx_internal_id`, 3658350919 AS `class_crc`, 0 AS
>>> `sphinx_deleted`, `donates`.`county_id` AS `county_id`,
>>> `donates`.`category_id` AS `category_id`, `donates`.`non_profit_id` AS
>>> `non_profit_id`, `donates`.`event_id` AS `event_id` FROM
>>> `donates` LEFT OUTER JOIN `events` ON `events`.`id` =
>>> `donates`.`event_id` LEFT OUTER JOIN `non_profits` ON
>>> `non_profits`.`id` = `donates`.`non_profit_id` WHERE
>>> (`donates`.`id` >= $start AND `donates`.`id` <= $end AND
>>> `donates`.`delta` = 1) GROUP BY  `donates`.`id` ORDER BY  NULL
>>>  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
>>> FROM `donates` WHERE `donates`.`delta` = 1
>>>  sql_attr_uint = sphinx_internal_id
>>>  sql_attr_uint = class_crc
>>>  sql_attr_uint = sphinx_deleted
>>>  sql_attr_uint = county_id
>>>  sql_attr_uint = category_id
>>>  sql_attr_uint = non_profit_id
>>>  sql_attr_uint = event_id
>>>  sql_query_info = SELECT * FROM `donates` WHERE `id` = (($id - 0) /
>>> 2)
>>> }
>> 
>>> index donate_delta : donate_core
>>> {
>>>  source = donate_delta_0
>>>  path = /home/pc15/Projects/vivendosdevelopment/db/sphinx/development/
>>> donate_delta
>>> }
>> 
>>> index donate
>>> {
>>>  type = distributed
>>>  local = donate_delta
>>>  local = donate_core
>>> }
>> 
>>> source non_profit_core_0
>>> {
>>>  type = mysql
>>>  sql_host = localhost
>>>  sql_user = root
>>>  sql_pass =
>>>  sql_db = vivendos_development
>>>  sql_query_pre = UPDATE `non_profits` SET `delta` = 0 WHERE `delta` =
>>> 1
>>>  sql_query_pre = SET NAMES utf8
>>>  sql_query_pre = SET TIME_ZONE = '+0:00'
>>>  sql_query = SELECT     SQL_NO_CACHE `non_profits`.`id` * 2 + 1 AS
>>> `id` , `non_profits`.`nonprofit_name` AS `nonprofit_name`,
>>> `non_profits`.`city` AS `city`, `non_profits`.`id` AS
>>> `sphinx_internal_id`, 1641007040 AS `class_crc`, 0 AS
>>> `sphinx_deleted`, `non_profits`.`county_id` AS `county_id` FROM
>>> `non_profits` WHERE     (`non_profits`.`id` >= $start AND
>>> `non_profits`.`id` <= $end AND `non_profits`.`delta` = 0) GROUP BY
>>> `non_profits`.`id` ORDER BY  NULL
>>>  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
>>> FROM `non_profits` WHERE `non_profits`.`delta` = 0
>>>  sql_attr_uint = sphinx_internal_id
>>>  sql_attr_uint = class_crc
>>>  sql_attr_uint = sphinx_deleted
>>>  sql_attr_uint = county_id
>>>  sql_query_info = SELECT * FROM `non_profits` WHERE `id` = (($id -
>>> 1) / 2)
>>> }
>> 
>>> index non_profit_core
>>> {
>>>  source = non_profit_core_0
>>>  path = /home/pc15/Projects/vivendosdevelopment/db/sphinx/development/
>>> non_profit_core
>>>  charset_type = utf-8
>>>  min_prefix_len = 1
>>>  min_infix_len = 3
>>>  enable_star = 1
>>> }
>> 
>>> source non_profit_delta_0 : non_profit_core_0
>>> {
>>>  type = mysql
>>>  sql_host = localhost
>>>  sql_user = root
>>>  sql_pass =
>>>  sql_db = vivendos_development
>>>  sql_query_pre =
>>>  sql_query_pre = SET NAMES utf8
>>>  sql_query_pre = SET TIME_ZONE = '+0:00'
>>>  sql_query = SELECT     SQL_NO_CACHE `non_profits`.`id` * 2 + 1 AS
>>> `id` , `non_profits`.`nonprofit_name` AS `nonprofit_name`,
>>> `non_profits`.`city` AS `city`, `non_profits`.`id` AS
>>> `sphinx_internal_id`, 1641007040 AS `class_crc`, 0 AS
>>> `sphinx_deleted`, `non_profits`.`county_id` AS `county_id` FROM
>>> `non_profits` WHERE     (`non_profits`.`id` >= $start AND
>>> `non_profits`.`id` <= $end AND `non_profits`.`delta` = 1) GROUP BY
>>> `non_profits`.`id` ORDER BY  NULL
>>>  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
>>> FROM `non_profits` WHERE `non_profits`.`delta` = 1
>>>  sql_attr_uint = sphinx_internal_id
>>>  sql_attr_uint = class_crc
>>>  sql_attr_uint = sphinx_deleted
>>>  sql_attr_uint = county_id
>>>  sql_query_info = SELECT * FROM `non_profits` WHERE `id` = (($id -
>>> 1) / 2)
>>> }
>> 
>>> index non_profit_delta : non_profit_core
>>> {
>>>  source = non_profit_delta_0
>>>  path = /home/pc15/Projects/vivendosdevelopment/db/sphinx/development/
>>> non_profit_delta
>>> }
>> 
>>> index non_profit
>>> {
>>>  type = distributed
>>>  local = non_profit_delta
>>>  local = non_profit_core
>>> }
>> 
>>> On Oct 4, 4:00 pm, Pat Allan <[email protected]> wrote:
>>>> What does the source definition for your NonProfit model look like in 
>>>> development.sphinx.conf? Make sure you remove your database password.
>> 
>>>> --
>>>> Pat
>> 
>>>> On 04/10/2010, at 4:41 PM, thunderz14enator wrote:
>> 
>>>>> location(params[:locations]) returns the value of the checkbox which
>>>>> is an ID of the data
>> 
>>>>> I did rake ts:stop and rebuld the sphinx also
>>>>> and one thing that i ran this command in my rails console also
>> 
>>>>> irb(main):004:0> @nonprofits  = NonProfit.search "",:with =>
>>>>> {:county_id => 2}
>>>>> => []
>>>>> irb(main):005:0>
>> 
>>>>> though i have the fields related to county id in my database
>> 
>>>>> ----
>> 
>>>>> On Oct 1, 7:11 pm, Pat Allan <[email protected]> wrote:
>>>>>> Can you give us an example of what location(params[:locations]) returns?
>> 
>>>>>> Also, can you run ts:stop, and then confirm there are no other searchd 
>>>>>> instances running, and then run ts:rebuild? Sometimes nil results are 
>>>>>> obtained because there's a different Sphinx instance running that's 
>>>>>> looking at other index files, hence the mismatch.
>> 
>>>>>> Cheers
>> 
>>>>>> --
>>>>>> Pat
>> 
>>>>>> On 01/10/2010, at 6:42 PM, thunderz14enator wrote:
>> 
>>>>>>> Hi,
>> 
>>>>>>> I have a secnario where i m searching the result on the basis of
>>>>>>> checkbox,when i check the particual check box it passes an id called
>>>>>>> as "county_id", no i have county_id in my database and when i m trying
>>>>>>> to search the data according to "county_id", its gives me a nil
>>>>>>> result ,though i have data with that particular  county id ..
>> 
>>>>>>> the steps i follwoed are
>> 
>>>>>>> 1 created a filed in my table naming county id.
>> 
>>>>>>> 2 in my model i added these lines
>> 
>>>>>>>    define_index do
>>>>>>>    indexes nonprofit_name
>>>>>>>    indexes city
>>>>>>>    has county_id
>>>>>>>    #    has city
>>>>>>>    set_property :delta => true
>>>>>>>    set_property :enable_star => true
>>>>>>>    set_property :min_prefix_len => 1
>>>>>>>  end
>> 
>>>>>>> 3 in my controller
>> 
>>>>>>>   def nonprofit_sort
>>>>>>>    if !params[:locations].blank? && !params[:search].blank?
>>>>>>>      @nonprofits  = NonProfit.search params[:search],:with =>
>>>>>>> {:county_id=> location(params[:locations])},:star => true
>> 
>>>>>>>    elsif !params[:locations].blank?
>> 
>>>>>>>      @nonprofits  = NonProfit.search params[:search],:with =>
>>>>>>> {:county_id => location(params[:locations])},:star => truep "finished
>>>>>>> search"
>>>>>>>    elsif !params[:search].blank?
>> 
>>>>>>>      @nonprofits  = NonProfit.search params[:search],:star => true
>>>>>>>           else
>>>>>>>      @nonprofits=  NonProfit.search params[:search],:star => true
>>>>>>>           end
>>>>>>>  end
>> 
>>>>>>> 4. Rebuilded the index
>> 
>>>>>>> I m totally clueless about getting the nill result
>> 
>>>>>>> --
>>>>>>> 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
>> 
>> ...
>> 
>> read more ยป
> 
> -- 
> 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.

Reply via email to