Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Last active December 14, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerodsanto/5042633 to your computer and use it in GitHub Desktop.
Save jerodsanto/5042633 to your computer and use it in GitHub Desktop.
[ext2/1/ext 1 (0,20)] [straight_topics_core`, `infix_topics_core] apple @sphinx_internal_class_name (Topic)
source straight_topics_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = redacted_dev
sql_query = SELECT SQL_NO_CACHE `topics`.`id` * 5 + 2 AS `id`, 'Topic' AS `sphinx_internal_class_name`, `topics`.`name` AS `name`, `topics`.`id` AS `sphinx_internal_id`, 'Topic' AS `sphinx_internal_class`, 0 AS `sphinx_deleted` FROM `topics` WHERE (`topics`.`id` >= $start AND `topics`.`id` <= $end) GROUP BY `topics`.`id`, `topics`.`name`, `topics`.`id` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`topics`.`id`), 1), IFNULL(MAX(`topics`.`id`), 1) FROM `topics`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = sphinx_deleted
sql_attr_string = sphinx_internal_class
sql_field_string = name
sql_query_info = SELECT `topics`.* FROM `topics` WHERE (`topics`.`id` = ($id - 2) / 5)
}
index straight_topics_core
{
path = /Users/jerod/src/ruby/rails/redacted/db/sphinx/development/straight_topics_core
docinfo = extern
morphology = stem_en
charset_type = utf-8
source = straight_topics_core_0
}
source infix_topics_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = redacted_dev
sql_query = SELECT SQL_NO_CACHE `topics`.`id` * 5 + 2 AS `id`, 'Topic' AS `sphinx_internal_class_name`, `topics`.`name` AS `name`, `topics`.`id` AS `sphinx_internal_id`, 'Topic' AS `sphinx_internal_class`, 0 AS `sphinx_deleted` FROM `topics` WHERE (`topics`.`id` >= $start AND `topics`.`id` <= $end) GROUP BY `topics`.`id`, `topics`.`name`, `topics`.`id` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`topics`.`id`), 1), IFNULL(MAX(`topics`.`id`), 1) FROM `topics`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = sphinx_deleted
sql_attr_string = sphinx_internal_class
sql_field_string = name
sql_query_info = SELECT `topics`.* FROM `topics` WHERE (`topics`.`id` = ($id - 2) / 5)
}
index infix_topics_core
{
path = /Users/jerod/src/ruby/rails/redacted/db/sphinx/development/infix_topics_core
docinfo = extern
morphology = stem_en
charset_type = utf-8
min_infix_len = 2
enable_star = 1
source = infix_topics_core_0
}
Topic.search("apple", index_weights: {"straight_topics_core" => 3, "infix_topics_core" => 1}).first(5).map(&:name)
# => ["apple"]
Topic.search("apple", star: true, index_weights: {"straight_topics_core" => 3, "infix_topics_core" => 1}).first(5).map(&:name)
# => ["appleton", "applevalleycalifornia", "applevalleyminnesota", "apple", "applebees"]
development:
morphology: stem_en
bin_path: /usr/local/bin/
ThinkingSphinx::Index.define :topic, with: :active_record, name: "straight_topics" do
indexes :name, sortable: true
end
ThinkingSphinx::Index.define :topic, with: :active_record, name: "infix_topics" do
indexes :name, sortable: true
set_property enable_star: true, min_infix_len: 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment