Here it is in my production.sphinx.conf instead.
indexer
{
}
searchd
{
listen = 127.0.0.1:9791
log = /var/www/abc.com/public/abc/releases/20101008073517/log/
searchd.log
query_log = /var/www/abc.com/public/abc/releases/20101008073517/log/
searchd.query.log
pid_file = /var/www/abc.com/public/abc/releases/20101008073517/log/
searchd.production.pid
}
source spot_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = abc_production
sql_query_pre = SET NAMES utf8
sql_query_pre = SET TIME_ZONE = '+0:00'
sql_query = SELECT SQL_NO_CACHE `spots`.`id` * 2 + 0 AS `id` ,
`spots`.`name` AS `name`, `spots`.`address` AS `address`,
`spots`.`city` AS `city`, `spots`.`state` AS `state`,
`spots`.`country` AS `country`, `spots`.`spot_type` AS `spot_type`,
`spots`.`description` AS `description`, `spots`.`id` AS
`sphinx_internal_id`, 419485005 AS `class_crc`, 0 AS `sphinx_deleted`,
IFNULL(`spots`.`name`, '') AS `name_sort`, `spots`.`rating_average` AS
`rating_average` FROM `spots` WHERE `spots`.`id` >= $start AND
`spots`.`id` <= $end GROUP BY `spots`.`id` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
FROM `spots`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = class_crc
sql_attr_uint = sphinx_deleted
sql_attr_str2ordinal = name_sort
sql_attr_float = rating_average
sql_query_info = SELECT * FROM `spots` WHERE `id` = (($id - 0) / 2)
}
index spot_core
{
source = spot_core_0
path = /var/www/abc.com/public/abc/shared/db/sphinx/spot_core
charset_type = utf-8
min_infix_len = 3
enable_star = 1
}
index spot
{
type = distributed
local = spot_core
}
source trip_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = Sp[Hry{X~6jjF437[DD
sql_db = abc_production
sql_query_pre = SET NAMES utf8
sql_query_pre = SET TIME_ZONE = '+0:00'
sql_query = SELECT SQL_NO_CACHE `trips`.`id` * 2 + 1 AS `id` ,
`trips`.`name` AS `name`, `trips`.`duration` AS `duration`,
GROUP_CONCAT(DISTINCT IFNULL(`spots`.`name`, '0') SEPARATOR ' ') AS
`spot_name`, GROUP_CONCAT(DISTINCT IFNULL(`spots`.`city`, '0')
SEPARATOR ' ') AS `spot_city`, GROUP_CONCAT(DISTINCT
IFNULL(`spots`.`state`, '0') SEPARATOR ' ') AS `spot_state`,
GROUP_CONCAT(DISTINCT IFNULL(`spots`.`country`, '0') SEPARATOR ' ') AS
`spot_country`, `trips`.`id` AS `sphinx_internal_id`, 3596900869 AS
`class_crc`, 0 AS `sphinx_deleted`, IFNULL(`trips`.`name`, '') AS
`name_sort`, `trips`.`budget` AS `budget`,
UNIX_TIMESTAMP(`trips`.`created_at`) AS `created_at`,
`trips`.`rating_average` AS `rating_average` FROM `trips` LEFT
OUTER JOIN `spot_trips` ON (`trips`.`id` = `spot_trips`.`trip_id`)
LEFT OUTER JOIN `spots` ON (`spots`.`id` = `spot_trips`.`spot_id`)
WHERE `trips`.`id` >= $start AND `trips`.`id` <= $end GROUP BY
`trips`.`id` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
FROM `trips`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = class_crc
sql_attr_uint = sphinx_deleted
sql_attr_timestamp = created_at
sql_attr_str2ordinal = name_sort
sql_attr_float = budget
sql_attr_float = rating_average
sql_query_info = SELECT * FROM `trips` WHERE `id` = (($id - 1) / 2)
}
index trip_core
{
source = trip_core_0
path = /var/www/abc.com/public/abc/shared/db/sphinx/trip_core
charset_type = utf-8
min_infix_len = 3
enable_star = 1
}
index trip
{
type = distributed
local = trip_core
}
On Nov 1, 5:19 pm, Pat Allan <[email protected]> wrote:
> Hmm, haven't figured out the problem yet. What does your trip_core_0 source
> look like in sphinx/development.sphinx.conf? Make sure you remove the
> database password :)
>
> --
> Pat
>
> On 01/11/2010, at 8:15 PM, Victor wrote:
>
> > Currently testing with just one or two each, but they are not
> > limited.
>
> > Some spots are tied to trip_day too, but it's just for order purpose.
> > Lemme know if you need to look into that code too.
>
> > I also have the following codes:
>
> > spot_trip.rb
> > =====
> > class SpotTrip < ActiveRecord::Base
> > belongs_to :trip
> > belongs_to :spot
>
> > def spot_name
> > spot.name if spot.try(:name)
> > end
>
> > def spot_type
> > spot.spot_type if spot.try(:spot_type)
> > end
> > end
>
> > On Nov 1, 5:08 pm, Pat Allan <[email protected]> wrote:
> >> Okay... how many spots are usually tied to a trip? A few? Dozens? Hundred?
>
> >> --
> >> Pat
>
> >> On 01/11/2010, at 8:02 PM, Victor wrote:
>
> >>> Hi Pat,
>
> >>> Yes, rebuilt is done, and I did not change the model.
>
> >>> Yes, related trip is not being return.
>
> >>> For example:
>
> >>> Trip: 3 day Victoria trip.
> >>> Spots in the trip above: Old Melbourne Gaol, Melbourne Museum, The Art
> >>> Gallery
>
> >>> Each spot has an individual page of course.
>
> >>> When I search Victoria, the trip above will show in result. But if I
> >>> search "Old Melbourne Gaol", or any of the spots.name, it returns 0
> >>> result. This actually happens to the site-wide search.
>
> >>> By the way, the codes I gave were just snippets, which I think they
> >>> are the only one related.
>
> >>> Thanks.
>
> >>> On Nov 1, 4:57 pm, Pat Allan <[email protected]> wrote:
> >>>> Hi Victor
>
> >>>> Just to confirm: are you searching for a word that appears in a spot
> >>>> name (or city, state, country), and the related trip is not being
> >>>> returned?
>
> >>>> Have you run 'rake ts:rebuild' since adding those fields?
>
> >>>> Cheers
>
> >>>> --
> >>>> Pat
>
> >>>> On 01/11/2010, at 7:51 PM, Victor wrote:
>
> >>>>> Hi Pat,
>
> >>>>> I'm using the following:
>
> >>>>> Rails 2.3.8, Sphinx 1.10-beta, TS 1.3.20
>
> >>>>> If you looked at the code below, I would like to search Spots
> >>>>> (different model) name, city, state, country listed in Trips. Somehow
> >>>>> my search filter only works on the name of the Trip, but not the spots
> >>>>> in it.
>
> >>>>> trip.rb
> >>>>> =====
> >>>>> class Trip < ActiveRecord::Base
> >>>>> has_many :spots, :through => :spot_trips
>
> >>>>> # ThinkingSphinx Index
> >>>>> define_index do
> >>>>> indexes :name, :sortable => true
> >>>>> indexes duration
> >>>>> indexes spots.name, :as => :spot_name
> >>>>> indexes spots.city, :as => :spot_city
> >>>>> indexes spots.state, :as => :spot_state
> >>>>> indexes spots.country, :as => :spot_country
> >>>>> has budget, created_at, rating_average
> >>>>> end
> >>>>> end
>
> >>>>> trips_controller.rb
> >>>>> =======
> >>>>> class TripsController < ApplicationController
> >>>>> before_filter :require_user, :except => [:show, :index]
>
> >>>>> def index
> >>>>> if params[:filter] == 'on'
> >>>>> country = params[:country] == 'All' ? {} : {:spot_country =>
> >>>>> params[:country]}
> >>>>> duration = params[:days].blank? ? "" : params[:days]
>
> >>>>> if !duration.blank? && country
> >>>>> conditions = {:duration => duration}.merge(country)
> >>>>> elsif !duration.blank? && country.blank?
> >>>>> conditions = {:duration => duration}
> >>>>> else country && duration.blank?
> >>>>> conditions = country
> >>>>> end
>
> >>>>> keyword = params[:keyword].blank? ? "" : params[:keyword]
>
> >>>>> case params[:order]
> >>>>> when 'date_descend'
> >>>>> order = {:order => 'created_at DESC'}
> >>>>> when 'date_ascend'
> >>>>> order = {:order => 'created_at ASC'}
> >>>>> when 'rating_descend'
> >>>>> order = {:order => 'rating_average DESC'}
> >>>>> when 'rating_ascend'
> >>>>> order = {:order => 'rating_average ASC'}
> >>>>> when 'budget_dscend'
> >>>>> order = {:order => 'budget DESC'}
> >>>>> when 'budget_ascend'
> >>>>> order = {:order => 'budget ASC'}
> >>>>> else
> >>>>> order = {}
> >>>>> end
>
> >>>>> results = Trip.search params[:keyword], {:conditions =>
> >>>>> conditions, :star => true}.merge(order)
> >>>>> �...@trips = results.paginate(:page => params[:page])
> >>>>> else
> >>>>> �...@trips = Trip.paginate(:all, :page => params[:page], :order =>
> >>>>> 'created_at DESC')
> >>>>> end
> >>>>> end
>
> >>>>> index.html.erb for trip
> >>>>> =====
> >>>>> I have these for filters:
>
> >>>>> <%= text_field_tag 'keyword' %>
> >>>>> <select name="country">
> >>>>> <option>All</option>
> >>>>> <option value="Afghanistan">Afghanistan</option>
> >>>>> .
> >>>>> .
> >>>>> </select>
> >>>>> <input class="duration" name="days" />
> >>>>> <select name="order">
> >>>>> <option value="date_descend" <%= params[:order] == 'date_dscend' ?
> >>>>> 'selected' : ''%>>
> >>>>> Date: Latest to earliest
> >>>>> </option>
> >>>>> <option value="date_ascend" <%= params[:order] == 'date_ascend' ?
> >>>>> 'selected' : ''%>>
> >>>>> Date: Earliest to latest
> >>>>> </option>
> >>>>> <option value="rating_descend" <%= params[:order] ==
> >>>>> 'rating_descend' ? 'selected' : ''%>>
> >>>>> Rating: Highest to lowest
> >>>>> </option>
> >>>>> <option value="rating_ascend" <%= params[:order] ==
> >>>>> 'rating_ascend' ? 'selected' : ''%>>
> >>>>> Rating: Lowest to highest
> >>>>> </option>
> >>>>> </select>
>
> >>>>> Thanks.
>
> >>>>> --
> >>>>> 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
> > 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.