Created
October 13, 2009 11:47
-
-
Save sarah/209176 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here are the define index blocks for | |
Asset: | |
define_index do | |
indexes filename, content_type, description, attachment_type | |
has attachment_id | |
set_property :delta => true | |
end | |
sphinx_scope(:by_element){|element_id| | |
{:with => {:attachment_id => element_id, :attachment_type => "Project::Element"}} | |
} | |
Project::Element::Task | |
define_index do | |
indexes description | |
has element_id | |
set_property :delta => true | |
end | |
sphinx_scope(:by_element){|element_id| | |
{:with => {:element_id => element_id}} | |
} | |
When I run "ThinkingSphinx.search" (without arguments) I actually get a ton of output -- hadn't tried this before: | |
ThinkingSphinx.search | |
Querying Sphinx: | |
Project::Element::Task Load (0.076245) SELECT * FROM `project_element_tasks` WHERE (`project_element_tasks`.`id` IN (12,13,14,15,16,17,18)) | |
Project::Element Load (0.008887) SELECT * FROM `project_elements` WHERE (`project_elements`.`id` IN (61,62,63,64,65)) AND (project_elements.deleted_at IS NULL OR project_elements.deleted_at > '2009-10-13 11:43:49') | |
Asset Load (0.000743) SELECT * FROM `assets` WHERE (`assets`.`id` IN (462,463,464,465,466,467,468,469)) | |
=> [#<Project::Element::Task id: 12, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:23", updated_at: "2009-09-28 18:23:23", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 13, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:50", updated_at: "2009-09-28 18:23:50", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 14, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:50", updated_at: "2009-09-28 18:23:50", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 15, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:51", updated_at: "2009-09-28 18:23:51", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 16, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:52", updated_at: "2009-09-28 18:23:52", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 17, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:23:53", updated_at: "2009-09-28 18:23:53", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element::Task id: 18, element_id: 44, description: "another task", status: "not_started", due: "2010-02-03 00:00:00", created_at: "2009-09-28 18:24:26", updated_at: "2009-09-28 18:24:26", created_by_id: 96, started_on: nil, completed_on: nil, percent_complete: 0, high_priority: nil, delta: false>, #<Project::Element id: 61, title: "lingerie", description: nil, parent_id: nil, element_type: nil, created_at: "2009-09-28 18:29:59", updated_at: "2009-09-28 18:29:59", project_id: 16, created_by_id: 96, interactable_by_client: false, deleted_at: nil, status: nil, deleted_by: nil, delta: false>, #<Project::Element id: 62, title: "costumes", description: nil, parent_id: nil, element_type: nil, created_at: "2009-09-28 18:30:05", updated_at: "2009-09-28 18:30:05", project_id: 16, created_by_id: 96, interactable_by_client: false, deleted_at: nil, status: nil, deleted_by: nil, delta: false>, #<Project::Element id: 63, title: "comps2", description: nil, parent_id: nil, element_type: nil, created_at: "2009-09-28 18:30:13", updated_at: "2009-09-28 18:31:08", project_id: 16, created_by_id: 96, interactable_by_client: false, deleted_at: nil, status: nil, deleted_by: nil, delta: false>, #<Project::Element id: 64, title: "comps", description: nil, parent_id: 61, element_type: nil, created_at: "2009-09-28 18:31:16", updated_at: "2009-09-28 18:31:16", project_id: 16, created_by_id: 96, interactable_by_client: false, deleted_at: nil, status: nil, deleted_by: nil, delta: false>, #<Project::Element id: 65, title: "sarah_adds", description: nil, parent_id: nil, element_type: nil, created_at: "2009-09-29 12:58:17", updated_at: "2009-09-29 12:58:17", project_id: 17, created_by_id: 7, interactable_by_client: false, deleted_at: nil, status: nil, deleted_by: nil, delta: false>, #<Asset id: 462, parent_id: nil, content_type: "image/jpeg", filename: "4.jpg", thumbnail: nil, size: 130682, width: 1024, height: 637, attachment_id: 44, attachment_type: "Project::Element", asset_tag: "image", created_at: "2009-09-28 18:24:56", updated_at: "2009-09-28 18:24:56", version: 1, title: "4.jpg", description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: 96, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 463, parent_id: 462, content_type: "image/jpeg", filename: "4_thumb.jpg", thumbnail: "thumb", size: 130682, width: 111, height: 69, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:24:57", updated_at: "2009-09-28 18:24:57", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 464, parent_id: 462, content_type: "image/jpeg", filename: "4_large.jpg", thumbnail: "large", size: 130682, width: 659, height: 410, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:24:57", updated_at: "2009-09-28 18:24:57", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 465, parent_id: 462, content_type: "image/jpeg", filename: "4_icon.jpg", thumbnail: "icon", size: 130682, width: 58, height: 36, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:24:58", updated_at: "2009-09-28 18:24:58", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 466, parent_id: nil, content_type: "image/jpeg", filename: "3.jpg", thumbnail: nil, size: 210592, width: 1024, height: 637, attachment_id: 44, attachment_type: "Project::Element", asset_tag: "image", created_at: "2009-09-28 18:25:00", updated_at: "2009-09-28 18:25:00", version: 1, title: "3.jpg", description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: 96, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 467, parent_id: 466, content_type: "image/jpeg", filename: "3_thumb.jpg", thumbnail: "thumb", size: 210592, width: 111, height: 69, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:25:01", updated_at: "2009-09-28 18:25:01", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 468, parent_id: 466, content_type: "image/jpeg", filename: "3_large.jpg", thumbnail: "large", size: 210592, width: 659, height: 410, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:25:01", updated_at: "2009-09-28 18:25:01", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>, #<Asset id: 469, parent_id: 466, content_type: "image/jpeg", filename: "3_icon.jpg", thumbnail: "icon", size: 210592, width: 58, height: 36, attachment_id: nil, attachment_type: nil, asset_tag: "image", created_at: "2009-09-28 18:25:02", updated_at: "2009-09-28 18:25:02", version: 1, title: nil, description: nil, asset_versions_count: 0, interactable_by_client: false, final: nil, created_by_id: nil, deleted_by: nil, deleted_at: nil, status: nil, delta: false>] | |
But, when I run it *with* arguments (that I know are indexed and exist), I get nothing | |
>> ThinkingSphinx.search "Default" | |
Querying Sphinx: house | |
=> [] | |
>> Project::Element.search "Default" | |
Querying Sphinx: Default | |
=> [] | |
Even though I index title | |
Project::Element | |
define_index do | |
indexes title, description | |
has project_id | |
set_property :delta => true | |
end | |
sphinx_scope(:by_project){|project_id| | |
{:with => {:project_id => project_id}} | |
} | |
# and I have a lot of elements with the title "Default"... | |
>> Project::Element.all.map(&:title) | |
Project::Element Load (0.047448) SELECT * FROM `project_elements` WHERE (project_elements.deleted_at IS NULL OR project_elements.deleted_at > '2009-10-13 12:27:50') | |
=> ["Default", "Default", "Default", "Default", "Default", "Default", "Default", "Default", "Default", "Default", "Default", "Default", "Elements", "Default", "House pics", "wills element-renamed", "super long element name lets see what happens with this", "more elements", "little element inside", "Image Upload Tests", "dave", "File Type Tests", "jons", "new element in house pics - or not", "multiple uploads", "look a new folder", "new folder", "new element", "Default", "Fonts", "Photoshop Files", "Flash", "Code", "test", "Fonts", "Photoshop Files", "Flash", "Code", "legave corp homepage", "legave lingerie", "legaveue costumes", "legavenue shoes", "subfolder", "new font", "test", "sarah_folder", "testing", "my cats", "new top level element", "lingerie", "costumes", "comps2", "comps", "sarah_adds"] | |
# Note index on localhost does not give warnings: | |
using config file '/Users/sarah/Sites/canvasband/config/development.sphinx.conf'... | |
indexing index 'asset_visual_note_core'... | |
collected 3 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 3 docs, 315 bytes | |
total 0.298 sec, 1055.92 bytes/sec, 10.06 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.321 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 18 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 18 docs, 1019 bytes | |
total 0.045 sec, 22563.21 bytes/sec, 398.56 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_core'... | |
collected 26 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 26 docs, 603 bytes | |
total 0.311 sec, 1935.99 bytes/sec, 83.48 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 'project_element_core'... | |
collected 64 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 64 docs, 556 bytes | |
total 0.103 sec, 5392.77 bytes/sec, 620.75 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_event_core'... | |
collected 6 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 6 docs, 197 bytes | |
total 0.049 sec, 3990.11 bytes/sec, 121.53 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. | |
indexing index 'project_membership_core'... | |
collected 6 docs, 0.0 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done | |
total 6 docs, 249 bytes | |
total 0.088 sec, 2818.43 bytes/sec, 67.91 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment