tag:support.flying-sphinx.com,2011-01-05:/discussions/problems/34-indexing-errorsFlying Sphinx: Discussion 2016-08-11T01:37:18Ztag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T12:00:07Z2011-08-16T12:00:10ZIndexing errors<div><p>Ah, some of these things might be related to switching from
mysql to postgres...</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T12:02:58Z2011-08-16T12:02:58ZIndexing errors<div><p>Yup - if you get stuck with it, I'm happy to provide suggestions
- though sharing your define_index block will certainly help with
that :)</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T13:17:44Z2011-08-16T13:17:46ZIndexing errors<div><p>Ah, I see, I need to add some group_bys... trying that now
;-)</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T13:30:56Z2011-08-16T13:30:57ZIndexing errors<div><p>Okay, all works now, except this line in the job model's
index:</p>
<p>has 'CRC32(country_string)', :as => :country_for_filtering,
:type => :integer</p>
<p>'indexing index 'job_core'... ERROR: index 'job_core':
sql_range_query: ERROR: function crc32(character varying) does not
exist<br>
LINE 1: ..."name", '') AS "job_name_sort", 1 AS "activated",
CRC32(coun...</p>
<pre>
<code> ^</code>
</pre>
<p>HINT: No function matches the given name and argument types. You
might need to add explicit type casts.<br>
(DSN=pgsql://lisuxygdfr:***@127.0.0.1:10323/lisuxygdfr). total 0
docs, 0 bytes<br>
total 0.056 sec, 0 bytes/sec, 0.00 docs/sec<br>
indexing index 'job_delta'...<br>
ERROR: index 'job_delta': sql_range_query: ERROR: function
crc32(character varying) does not exist<br>
LINE 1: ..."name", '') AS "job_name_sort", 1 AS "activated",
CRC32(coun...</p>
<pre>
<code> ^</code>
</pre>
<p>HINT: No function matches the given name and argument types. You
might need to add explicit type casts.<br>
(DSN=pgsql://lisuxygdfr:***@127.0.0.1:10323/lisuxygdfr).'</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T13:32:47Z2011-08-16T13:32:48ZIndexing errors<div><p>Hmm I will have to find a workaround for that crc32 thing.
However, when I take it out,<br>
I get the following error when searching with thinking sphinx:</p>
<p>Sphinx Sphinx Daemon returned error: no such filter attribute
'user_id'</p>
<p>Here is the user's index definition:</p>
<p>define_index do</p>
<pre>
<code>indexes(vorname, :as => :first_name, :sortable => true)
indexes(tags.name, :as => :tags)
indexes(company.name, :as => :company)
indexes(job.name, :as => :job)
# only index last name if privacy is turned off
indexes("CASE WHEN privacy_name = 0 THEN '' ELSE nachname END", :as => :last_name, :sortable => true)
# Geo stuff. Sphinx expects radians, we store degrees thus the conversion
has('RADIANS(users.lat)', :as => :lat, :type => :float)
has('RADIANS(users.lng)', :as => :lng, :type => :float)
# Index user id so we can exclude myself from search
has(:id, :as => :user_id)
# make sure we only hit activated users in searches (this allows for filtering)
has('1', :as => :activated, :type => :integer)
has "CASE WHEN users.country = 'Deutschland' THEN '0' ELSE CASE WHEN users.country = 'Schweiz' THEN '1' ELSE '2' END END", :as => :country_for_order_de, :type => :integer
has "CASE WHEN users.country = 'Schweiz' THEN '0' ELSE CASE WHEN users.country = 'Deutschland' THEN '1' ELSE '2' END END", :as => :country_for_order_ch, :type => :integer
has "CASE WHEN users.country = 'Österreich' THEN '0' ELSE CASE WHEN users.country = 'Deutschland' THEN '1' ELSE '2' END END", :as => :country_for_order_at, :type => :integer
group_by "users.privacy_name", "users.nachname", "users.lat", "users.lng", 'users.country'
# settings
if Rails.env.production? or Rails.env.staging?
set_property :delta => FlyingSphinx::DelayedDelta
end
set_property :latitude_attr => 'lat'
set_property :longitue_attr => 'lng'
set_property :enable_star => true
set_property :min_infix_len => 1
set_property :morphology => 'none'</code>
</pre>
<p>end</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T16:09:44Z2011-08-16T16:09:46ZIndexing errors<div><p>Okay, fixed the last issue. Instead of using crc32 I simply
assign an int to each country for filtering.</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-16T16:10:22Z2011-08-16T16:10:24ZIndexing errors<div><p>Can you close the discussion? I can't.</p></div>Nicotag:support.flying-sphinx.com,2011-01-05:Comment/93326392011-08-17T06:03:24Z2011-08-17T06:03:24ZIndexing errors<div><p>Consider it closed - great to hear you got it all sorted.</p></div>Pat Allan