Jeff Cc wrote:
- No wildcards at all (Sphinx doesn’t support them)
Do you mean the "" feature (prefix and infix) ? Where
the search term “program*” matches the database text
“program”, “programmer”, “programs” …
Those work for me in version sphinx-0.9.8-svn-r1065 and
sphinx-0.9.8-svn-r1112 … I have done quite some testing
on r0165 (still testing the newest r1112) and that seems
to work OK for me. Set the “enable_star” to 1 and set a
min_prefix_leng or a min_infix_leng.
- No automatic updates - must rebuild entire index using cron jobs.
Indeed. But automatic rotation of indexes seems to work OK.
Indexing on my dataset takes 15 seconds (37000 records,
28 MByte) on a desktop PC.
Again using straight SQL, not the current state of your models
At least in one (limited) test, I have just used the :include
feature of ultrasphinx and that automatically created the SQL
for the sphinx configuration file. So, if I understand well,
that did use the AR model ?
From:
http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/classes/ActiveRecord/Base.html
- Including a field from an association
Use the :include key.
Accepts an array of hashes.
:include => [{:association_name => ‘category’, :field => ‘name’, :as
=> ‘category_name’}]
Each should contain an :association_name key (the association name for
the included model), a :field key (the name of the field to include),
and an optional :as key (what to name the field in the parent).
So in my Model for jobs, that is as simple as e.g.:
class Job < ActiveRecord::Base
is_indexed :fields => [
‘title’]
:include => [
{:association_name => ‘employer’, :field => ‘name’}]
belongs_to :employer
…
The config file for sphinx that is calculated by ultrasphinx then has
automatically calcuated by ultrasphinx:
…
sql_query = SELECT (jobs.id * 1 + 0) AS id, ‘Job’ AS class, 0 AS
class_id, jobs.
title AS title, employer.name AS name, …
…
index complete
{
source = jobs
charset_type = utf-8
charset_table = 0…9, A…Z->a…z, -, _, &, a…z,
U+410…U+42F->U+430…U+44F, … and a lot more …
min_word_len = 2
min_infix_len = 4
stopwords =
enable_star = 1
path = /var/sphinx//sphinx_index_complete
docinfo = extern
morphology = none
min_prefix_len = 4
}
All of this seems to work for me (no production experience yet …).