I have two issues with delta indexes. First, I can not get them to
update from my dev browser. I do use Passenger even in development,
but I verified that searchd and apache(httpd) are running as the same
user. I also have bin_path set in my sphinx.yml file. If I add new
items from my console, then I can search for the new records fine.
Even when adding records from my browser, my log file has:
WorklingDeltaWorker#index:
{:delta_index_name=>"person_delta",
:uid=>"workling_delta_workers:index:d9ba9a4bbec22daca144db294206d7b2",
:core_index_name=>"person_core", :document_id=>242557}
ThinkingSphinx::Search.search_for_id is deprecated. Please use
ThinkingSphinx.search_for_id instead.
Querying Sphinx:
Any other ideas on what I can check?
Two classes for reference:
class WorklingDelta < ThinkingSphinx::Deltas::DefaultDelta
def index(model, instance = nil)
return true unless ThinkingSphinx.updates_enabled? &&
ThinkingSphinx.deltas_enabled?
return true if instance && !toggled(instance)
doc_id = instance ? instance.sphinx_document_id : nil
WorklingDeltaWorker.asynch_index(:delta_index_name =>
delta_index_name(model), :core_index_name => core_index_name
(model), :document_id => doc_id)
return true
end
end
class WorklingDeltaWorker < Workling::Base
def index(options = {})
logger.info("WorklingDeltaWorker#index: #{options.inspect}")
ThinkingSphinx::Deltas::DeltaJob.new(options
[:delta_index_name]).perform
if options[:document_id]
ThinkingSphinx::Deltas::FlagAsDeletedJob.new(options
[:core_index_name], options[:document_id]).perform
end
return true
end
end
If you are not familiar with workling, it allows for simple async
processing. In development mode, however, everything is executed
synchronously.
The second issue is that the index does not update when I change an
attribute. Here is some of my index:
define_index do
indexes first_name, last_name, :sortable => true
indexes [title, title1], :as => :title, :sortable => true
indexes description
has "CRC32(people.state)", :as => :state, :type => :integer
has "CRC32(people.country)", :as => :country, :type => :integer
has "CRC32(people.area_code)", :as => :area_code, :type
=> :integer
set_property :delta => WorklingDelta
end
When I create a new record from the console, I see the following:
using config file '/Users/dave/projects/msc/config/
development.sphinx.conf'...
indexing index 'person_delta'...
collected 1 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 1 docs, 12 bytes
total 0.235 sec, 51.03 bytes/sec, 4.25 docs/sec
rotating indices: succesfully sent SIGHUP to searchd (pid=32480).
=> true
However, if I update the state, country, or area_code, then nothing is
output, and the index is not updated. Note, I have the state, country,
and area_code as attributes because I want to filter on multiple
values. Is this a known issue? Do I need to move these to indexes and
use 'OR' searches to make this happy?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---