Skip to content

Instantly share code, notes, and snippets.

@sarah sarah/gist:207755
Created Oct 11, 2009

Embed
What would you like to do?
# Confirm my current directory is pointing to the most recent release
________________________________________________________________
$ls-l
lrwxrwxrwx 1 canvasband canvasband 75 Oct 10 17:27 current -> /home/canvasband/public_html/staging.canvasband.com/releases/20091010172708
# Confirm sphinx is running. To be honest, I'm not sure if this is running as the correct user. I tried running as root, but that gave me permission errors when trying to query.
________________________________________________________________
$ ps aux | grep search
1001 27478 0.0 0.2 28112 1208 pts/0 S 16:52 0:00 /usr/local/bin/searchd --pidfile --config /home/canvasband/public_html/staging.canvasband.com/releases/20091010172708/config/production.sphinx.conf
1001 27490 0.0 0.1 3936 600 pts/0 S+ 16:56 0:00 grep search
# Run an index
________________________________________________________________
rake RAILS_ENV=production ts:index
(in /home/canvasband/public_html/staging.canvasband.com/releases/20091010172708)
Generating Configuration to /home/canvasband/public_html/staging.canvasband.com/releases/20091010172708/config/production.sphinx.conf
Sphinx 0.9.8-rc2 (r1234)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/home/canvasband/public_html/staging.canvasband.com/releases/20091010172708/config/production.sphinx.conf'...
indexing index 'asset_core'...
collected 32 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 50.0% done
WARNING: duplicate document ids found
total 32 docs, 1040 bytes
total 0.079 sec, 13170.39 bytes/sec, 405.24 docs/sec
indexing index 'asset_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.044 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'asset' can not be directly indexed; skipping.
indexing index 'project_core'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
indexing index 'project_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'project' can not be directly indexed; skipping.
indexing index 'asset_visual_note_core'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
indexing index 'asset_visual_note_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'asset_visual_note' can not be directly indexed; skipping.
indexing index 'comment_core'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
indexing index 'comment_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'comment' can not be directly indexed; skipping.
indexing index 'project_membership_core'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
indexing index 'project_membership_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'project_membership' can not be directly indexed; skipping.
indexing index 'project_element_core'...
collected 5 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 5 docs, 37 bytes
total 0.010 sec, 3700.00 bytes/sec, 500.00 docs/sec
indexing index 'project_element_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'project_element' can not be directly indexed; skipping.
indexing index 'project_element_task_core'...
collected 14 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 50.0% done
WARNING: duplicate document ids found
total 14 docs, 168 bytes
total 0.010 sec, 16800.00 bytes/sec, 1400.00 docs/sec
indexing index 'project_element_task_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.061 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'project_element_task' can not be directly indexed; skipping.
indexing index 'project_event_core'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
indexing index 'project_event_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, nan% done
total 0 docs, 0 bytes
total 0.010 sec, 0.00 bytes/sec, 0.00 docs/sec
distributed index 'project_event' can not be directly indexed; skipping.
rotating indices: succesfully sent SIGHUP to searchd (pid=27478).
# Check permissions on my production.sphinx.conf file:
$ pwd
/home/canvasband/public_html/staging.canvasband.com/current/config
$ ls -l
-rw-r--r-- 1 canvasband canvasband 28815 Oct 11 16:51 production.sphinx.conf
# Check permissions on my log files:
________________________________________________________________
pwd
/home/canvasband/public_html/staging.canvasband.com/current/log
$ ls -l
total 22576
-rw-rw-rw- 1 canvasband canvasband 309 Nov 19 2008 development.log
-rw-r--r-- 1 canvasband canvasband 18868 Oct 11 16:19 newrelic_agent.passenger_My_Application.log
-rw-rw-rw- 1 canvasband canvasband 23014869 Oct 11 16:20 production.log
-rw-rw-rw- 1 canvasband canvasband 18642 Oct 11 16:52 searchd.log
-rw-rw-rw- 1 canvasband canvasband 6 Oct 1 13:36 searchd.production.pid
-rw-rw-rw- 1 canvasband canvasband 24090 Oct 11 16:53 searchd.query.log
# Confirm I have indexes:
________________________________________________________________
~/public_html/staging.canvasband.com/shared/db/sphinx/production$ ls -l
total 280
-rw-r--r-- 1 canvasband canvasband 384 Oct 11 17:00 asset_core.spa
-rw-r--r-- 1 canvasband canvasband 423 Oct 11 17:00 asset_core.spd
-rw-r--r-- 1 canvasband canvasband 357 Oct 11 17:00 asset_core.sph
-rw-r--r-- 1 canvasband canvasband 184 Oct 11 17:00 asset_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 asset_core.spl
-rw-r--r-- 1 canvasband canvasband 192 Oct 11 17:00 asset_core.spm
-rw-r--r-- 1 canvasband canvasband 313 Oct 11 17:00 asset_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_delta.spd
-rw-r--r-- 1 canvasband canvasband 377 Oct 11 17:00 asset_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 asset_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_delta.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_core.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_core.spd
-rw-r--r-- 1 canvasband canvasband 361 Oct 11 17:00 asset_visual_note_core.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_core.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_core.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_delta.spd
-rw-r--r-- 1 canvasband canvasband 361 Oct 11 17:00 asset_visual_note_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 asset_visual_note_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 asset_visual_note_delta.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 comment_core.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_core.spd
-rw-r--r-- 1 canvasband canvasband 340 Oct 11 17:00 comment_core.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 comment_core.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 comment_core.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 comment_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_delta.spd
-rw-r--r-- 1 canvasband canvasband 340 Oct 11 17:00 comment_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 comment_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 comment_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 comment_delta.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_core.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_core.spd
-rw-r--r-- 1 canvasband canvasband 270 Oct 11 17:00 project_core.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_core.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_core.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_delta.spd
-rw-r--r-- 1 canvasband canvasband 270 Oct 11 17:00 project_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_delta.spp
-rw-r--r-- 1 canvasband canvasband 120 Oct 11 17:00 project_element_core.spa
-rw-r--r-- 1 canvasband canvasband 26 Oct 11 17:00 project_element_core.spd
-rw-r--r-- 1 canvasband canvasband 284 Oct 11 17:00 project_element_core.sph
-rw-r--r-- 1 canvasband canvasband 49 Oct 11 17:00 project_element_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_element_core.spl
-rw-r--r-- 1 canvasband canvasband 60 Oct 11 17:00 project_element_core.spm
-rw-r--r-- 1 canvasband canvasband 11 Oct 11 17:00 project_element_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_element_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_delta.spd
-rw-r--r-- 1 canvasband canvasband 304 Oct 11 17:00 project_element_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_element_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_element_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_delta.spp
-rw-r--r-- 1 canvasband canvasband 168 Oct 11 17:00 project_element_task_core.spa
-rw-r--r-- 1 canvasband canvasband 59 Oct 11 17:00 project_element_task_core.spd
-rw-r--r-- 1 canvasband canvasband 259 Oct 11 17:00 project_element_task_core.sph
-rw-r--r-- 1 canvasband canvasband 27 Oct 11 17:00 project_element_task_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_element_task_core.spl
-rw-r--r-- 1 canvasband canvasband 84 Oct 11 17:00 project_element_task_core.spm
-rw-r--r-- 1 canvasband canvasband 29 Oct 11 17:00 project_element_task_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_element_task_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_task_delta.spd
-rw-r--r-- 1 canvasband canvasband 279 Oct 11 17:00 project_element_task_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_task_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_element_task_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_element_task_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_element_task_delta.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_event_core.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_core.spd
-rw-r--r-- 1 canvasband canvasband 332 Oct 11 17:00 project_event_core.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_event_core.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_event_core.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_event_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_delta.spd
-rw-r--r-- 1 canvasband canvasband 332 Oct 11 17:00 project_event_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_event_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_event_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_event_delta.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_core.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_core.spd
-rw-r--r-- 1 canvasband canvasband 384 Oct 11 17:00 project_membership_core.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_core.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_core.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_core.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_core.spp
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_delta.spa
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_delta.spd
-rw-r--r-- 1 canvasband canvasband 384 Oct 11 17:00 project_membership_delta.sph
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_delta.spi
-rw------- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_delta.spl
-rw-r--r-- 1 canvasband canvasband 0 Oct 11 17:00 project_membership_delta.spm
-rw-r--r-- 1 canvasband canvasband 1 Oct 11 17:00 project_membership_delta.spp
# start console
________________________________________________________________
$ ruby script/console production
>> ts = ThinkingSphinx
=> ThinkingSphinx
>> ts.methods false
=> ["unique_id_expression", "suppress_delta_output=", "use_group_by_shortcut?", "jruby?", "deltas_enabled?", "remote_sphinx?", "define_indexes?", "microsoft?", "version", "updates_enabled?", "sphinx_running_by_pid?", "define_indexes=", "indexed_models", "suppress_delta_output?", "sphinx_pid", "deltas_enabled=", "remote_sphinx=", "sphinx_running?", "mysql?", "updates_enabled=", "pid_active?"]
>> ts.sphinx_running?
=> true
>> ts.indexed_models
=> ["Asset", "Project", "Asset::VisualNote", "Comment", "Project::Membership", "Project::Element", "Project::Element::Task", "Project::Event"]
>> ts.sphinx_pid
=> "27478"
>> ts.pid_active? _
=> true
>> ts.sphinx_running_by_pid?
=> true
>> ts.search "house"
Querying Sphinx: house
=> []
*********************************************************
That's the kicker: it always immediately returns an empty array.
When I run the same query locally, it returns this:
# Running locally:
________________________________________________________________
>> ThinkingSphinx.search "house"
Querying Sphinx: house
Project Load (0.000308) SELECT * FROM `projects` WHERE (`projects`.`id` IN (13))
Project::Element Load (0.000286) SELECT * FROM `project_elements` WHERE (`project_elements`.`id` IN (13,61)) AND (project_elements.deleted_at IS NULL OR project_elements.deleted_at > '2009-10-11 17:02:34')
Comment Load (0.000229) SELECT * FROM `comments` WHERE (`comments`.`id` IN (18))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.