If I did "Spot.search "Inna Putri Bali"

>> Spot.search "Inna Putri Bali"
=> [#<Spot id: 2, spot_type: "accommodation", name: "Inna Putri Bali",
acc_type: "Hotel", operation_hours: "", check_in: "2000-01-01
14:00:00", check_out: "2000-01-01 13:00:00", season: "No season",
prices: "Check their website for latest deals. It's much che...",
country: "Indonesia", zip: "80363", state: "Bali", city: "Kuta",
address: "Jalan Kawasan Nusa Dua Resort", contact: "+62 361771020",
email: "[email protected]", web: "http://hotelputribali.com";,
description: "Inna Putri Bali is set on a wide of Nusa Dua. The e...",
reviews_count: 0, rating_average: #<BigDecimal:b65d3ffc,'0.0',4(8)>,
lat: #<BigDecimal:b65d3fac,'-0.8799857E1',12(16)>, lng:
#<BigDecimal:b65d3ee4,'0.115228862E3',12(20)>, created_at: "2010-10-20
04:12:17", updated_at: "2010-11-01 09:04:36", photos_count: 13>]
>>


On Nov 1, 5:48 pm, Victor <[email protected]> wrote:
> Trying "Inna Putri Bali" instead
>
> Loading production environment (Rails 2.3.8)
> ** Erubis 2.6.6>> Trip.search "Inna Putri Bali"
>
> => []
>
> Looks like we have a problem here huh...
>
> By the way, Old Melbourne Gaol was awesome. Went there once.
>
> On Nov 1, 5:41 pm, Pat Allan <[email protected]> wrote:
>
> > Right, that seems fine, so now let's look back within the Rails app. On the 
> > server, in 'script/console production', what's the output of the following:
> >   Trip.search "Old Melbourne Gaol"
>
> > --
> > Pat
>
> > On 01/11/2010, at 8:37 PM, Victor wrote:
>
> > > So I run 'ps aux | grep searchd'
>
> > > 1000     17569  0.0  0.2   9168  1144 ?        S    04:00   0:00
> > > searchd --pidfile --config /var/www/abc.com/public/abc/releases/
> > > 20101008073517/config/production.sphinx.conf
> > > 1000     20220  0.0  0.1   1864   700 pts/0    S+   17:34   0:00 grep
> > > --color=auto searchd
>
> > > Then 'rake ts:rebuild RAILS_ENV=production'
>
> > > ** Erubis 2.6.6
> > > Stopped search daemon (pid 17569).
> > > Generating Configuration to /var/www/abc.com/public/abc/releases/
> > > 20101008073517/config/production.sphinx.conf
> > > Sphinx 1.10-beta (r2420)
> > > Copyright (c) 2001-2010, Andrew Aksyonoff
> > > Copyright (c) 2008-2010, Sphinx Technologies Inc (http://
> > > sphinxsearch.com)
>
> > > using config file '/var/www/abc.com/public/abc/releases/20101008073517/
> > > config/production.sphinx.conf'...
> > > indexing index 'spot_core'...
> > > collected 7 docs, 0.0 MB
> > > sorted 0.0 Mhits, 100.0% done
> > > total 7 docs, 5351 bytes
> > > total 0.015 sec, 343828 bytes/sec, 449.78 docs/sec
> > > skipping non-plain index 'spot'...
> > > indexing index 'trip_core'...
> > > collected 3 docs, 0.0 MB
> > > sorted 0.0 Mhits, 100.0% done
> > > total 3 docs, 55 bytes
> > > total 0.004 sec, 13372 bytes/sec, 729.39 docs/sec
> > > skipping non-plain index 'trip'...
> > > total 12 reads, 0.000 sec, 8.1 kb/call avg, 0.0 msec/call avg
> > > total 24 writes, 0.000 sec, 9.0 kb/call avg, 0.0 msec/call avg
> > > Started successfully (pid 20236).
>
> > > Then 'ps aux | grep searchd'
>
> > > 1000     20236  0.0  0.1   9164   780 pts/0    S    17:35   0:00
> > > searchd --pidfile --config /var/www/abc.com/public/abc/releases/
> > > 20101008073517/config/production.sphinx.conf
> > > 1000     20238  0.0  0.1   1860   596 pts/0    S+   17:37   0:00 grep
> > > --color=auto searchd
>
> > > On Nov 1, 5:32 pm, Pat Allan <[email protected]> wrote:
> > >> Hi Victor
>
> > >> That seems fine...
> > >> What is the output of 'ps aux | grep searchd' before *and* after running 
> > >> 'rake ts:rebuild'?
>
> > >> I want to make sure we're dealing with just a single searchd instance 
> > >> that is noting the changes.
>
> > >> Cheers
>
> > >> --
> > >> Pat
>
> > >> On 01/11/2010, at 8:24 PM, Victor wrote:
>
> > >>> 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
>
> ...
>
> 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.

Reply via email to