-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loads of bonerific Sphinx integration
- Loading branch information
1 parent
e5c5432
commit 9a913c8
Showing
34 changed files
with
147 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$ -> | ||
# Make an etherpad (test) | ||
$("#padtest").pad | ||
'host' : 'http://10.30.201.4:9001' | ||
'padId' : 'test' | ||
'userName' : $('body').attr 'data-current-user-name' | ||
|
||
# Handle clever auto-searching | ||
timer = false | ||
|
||
$('#search input').keyup -> | ||
clearTimeout(timer) if timer | ||
|
||
timer = setTimeout => | ||
$.post RevisionHub.urls['searches_path'], { q: $(this).val() }, ( data, status, xhr ) -> | ||
$('#results').html data | ||
, 500 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
class SearchesController < ApplicationController | ||
def create # POST /searches?q=Bath+Comp+Sci+CS101 | ||
results = ThinkingSphinx::Search.search params[:q], :classes => [ University, Course, Tag, Note ] | ||
results = Note.search params[:q], :star => true | ||
|
||
respond_to do |format| | ||
format.json { render :json => results } | ||
format.html | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
class Course < ActiveRecord::Base | ||
belongs_to :university | ||
has_many :notes | ||
|
||
define_indexes do | ||
indexes :name | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class University < ActiveRecord::Base | ||
has_many :courses | ||
|
||
define_index do | ||
define_indexes do | ||
indexes :name | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
<form id="search" action="" method="GET"> | ||
<input class="title-text" type="text" name="query" size="10" maxlength="100" | ||
title="Type in course name or whatever the hell you want..." /> | ||
</form> | ||
|
||
<div id="results"> | ||
|
||
|
||
</div> | ||
<form id="search" action="" method="GET"> | ||
<input class="defaultText title-text" type="text" name="query" size="10" maxlength="100" title="Type in course name, uni or any other search queries..." /> | ||
</form> | ||
|
||
<div id="results"> | ||
|
||
|
||
</div> |
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
indexer | ||
{ | ||
} | ||
|
||
searchd | ||
{ | ||
listen = 127.0.0.1:9312 | ||
log = /Users/jamierumbelow/Sites/revisionhub/revisionhub/log/searchd.log | ||
query_log = /Users/jamierumbelow/Sites/revisionhub/revisionhub/log/searchd.query.log | ||
pid_file = /Users/jamierumbelow/Sites/revisionhub/revisionhub/log/searchd.development.pid | ||
} | ||
|
||
source course_core_0 | ||
{ | ||
type = mysql | ||
sql_host = localhost | ||
sql_user = root | ||
sql_pass = root | ||
sql_db = revisionhub_development | ||
sql_query_pre = SET NAMES utf8 | ||
sql_query_pre = SET TIME_ZONE = '+0:00' | ||
sql_query = SELECT SQL_NO_CACHE `courses`.`id` * CAST(3 AS SIGNED) + 0 AS `id` , `courses`.`name` AS `name`, `courses`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 288516751 AS `class_crc` FROM `courses` WHERE (`courses`.`id` >= $start AND `courses`.`id` <= $end) GROUP BY `courses`.`id` ORDER BY NULL | ||
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `courses` | ||
sql_attr_uint = sphinx_internal_id | ||
sql_attr_uint = sphinx_deleted | ||
sql_attr_uint = class_crc | ||
sql_query_info = SELECT * FROM `courses` WHERE `id` = (($id - 0) / 3) | ||
} | ||
|
||
index course_core | ||
{ | ||
source = course_core_0 | ||
path = /Users/jamierumbelow/Sites/revisionhub/revisionhub/db/sphinx/development/course_core | ||
charset_type = utf-8 | ||
} | ||
|
||
index course | ||
{ | ||
type = distributed | ||
local = course_core | ||
} | ||
|
||
source tag_core_0 | ||
{ | ||
type = mysql | ||
sql_host = localhost | ||
sql_user = root | ||
sql_pass = root | ||
sql_db = revisionhub_development | ||
sql_query_pre = SET NAMES utf8 | ||
sql_query_pre = SET TIME_ZONE = '+0:00' | ||
sql_query = SELECT SQL_NO_CACHE `tags`.`id` * CAST(3 AS SIGNED) + 1 AS `id` , `tags`.`name` AS `name`, `tags`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 1002762595 AS `class_crc` FROM `tags` WHERE (`tags`.`id` >= $start AND `tags`.`id` <= $end) GROUP BY `tags`.`id` ORDER BY NULL | ||
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `tags` | ||
sql_attr_uint = sphinx_internal_id | ||
sql_attr_uint = sphinx_deleted | ||
sql_attr_uint = class_crc | ||
sql_query_info = SELECT * FROM `tags` WHERE `id` = (($id - 1) / 3) | ||
} | ||
|
||
index tag_core | ||
{ | ||
source = tag_core_0 | ||
path = /Users/jamierumbelow/Sites/revisionhub/revisionhub/db/sphinx/development/tag_core | ||
charset_type = utf-8 | ||
} | ||
|
||
index tag | ||
{ | ||
type = distributed | ||
local = tag_core | ||
} | ||
|
||
source university_core_0 | ||
{ | ||
type = mysql | ||
sql_host = localhost | ||
sql_user = root | ||
sql_pass = root | ||
sql_db = revisionhub_development | ||
sql_query_pre = SET NAMES utf8 | ||
sql_query_pre = SET TIME_ZONE = '+0:00' | ||
sql_query = SELECT SQL_NO_CACHE `universities`.`id` * CAST(3 AS SIGNED) + 2 AS `id` , `universities`.`name` AS `name`, `universities`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 4012344892 AS `class_crc` FROM `universities` WHERE (`universities`.`id` >= $start AND `universities`.`id` <= $end) GROUP BY `universities`.`id` ORDER BY NULL | ||
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `universities` | ||
sql_attr_uint = sphinx_internal_id | ||
sql_attr_uint = sphinx_deleted | ||
sql_attr_uint = class_crc | ||
sql_query_info = SELECT * FROM `universities` WHERE `id` = (($id - 2) / 3) | ||
} | ||
|
||
index university_core | ||
{ | ||
source = university_core_0 | ||
path = /Users/jamierumbelow/Sites/revisionhub/revisionhub/db/sphinx/development/university_core | ||
charset_type = utf-8 | ||
} | ||
|
||
index university | ||
{ | ||
type = distributed | ||
local = university_core | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Empty file.
Empty file.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8399 |