Thank you again for your help;
The answer is:
>> Dish.connection.select_all('SELECT COALESCE(MIN("id"), 1::bigint),
COALESCE(MAX("id"), 1::bigint) FROM "dishes"')
=> [{"coalesce"=>"10337"}]
(I'm sorry but I don't know if it is my mistake if the mail is
missing, but I'm new to google groups)
--
Jorge
On 29 nov, 03:19, Pat Allan <[email protected]> wrote:
> Doesn't look like Thinking Sphinx is doing anything odd...
>
> Can you try the following in script/console?
> Dish.connection.select_all('SELECT COALESCE(MIN("id"), 1::bigint),
> COALESCE(MAX("id"), 1::bigint) FROM "dishes"')
>
> (And your email was missing again from google's moderation queue, but
> I've now flagged your account as not needing moderation, so hopefully
> that'll fix that problem).
>
> --
> Pat
>
> On 29/11/2009, at 1:09 PM, scriptbox wrote:
>
>
>
> > Hi Pat Alan;
>
> > First of all, thank you very much for helping me. I just don't know
> > what to do.
>
> > I checked the content for this file, and the user, pass, host, db
> > seems nice, but there is no schema. Here is the content for
> > dish_core_0:
>
> > source dish_core_0
> > {
> > type = pgsql
> > sql_host = localhost
> > sql_user = **********
> > sql_pass =
> > sql_db = amv
> > sql_query = SELECT "dishes"."id" * 3 + 1 AS "id" , "dishes"."label"
> > AS "label", "dishes"."id" AS "sphinx_internal_id", 894378886 AS
> > "class_crc", '894378886' AS "subclass_crcs", 0 AS "sphinx_deleted"
> > FROM "dishes" WHERE "dishes"."id" >= $start AND "dishes"."id" <=
> > $end GROUP BY "dishes"."id", "dishes"."label", "dishes"."id"
> > sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX
> > ("id"), 1::bigint) FROM "dishes"
> > sql_attr_uint = sphinx_internal_id
> > sql_attr_uint = class_crc
> > sql_attr_uint = sphinx_deleted
> > sql_attr_multi = uint subclass_crcs from field
> > sql_query_info = SELECT * FROM "dishes" WHERE "id" = (($id - 1) / 3)
> > }
>
> > On 29 nov, 03:01, Pat Allan <[email protected]> wrote:
> >> Hi Jorge
>
> >> This is a new issue, but let's start with the generated config file,
> >> config/development.sphinx.conf. What's the sql_query value for your
> >> dish_core_0 source?
>
> >> --
> >> Pat
>
> >> On 29/11/2009, at 11:06 AM, Pat Allan wrote:
>
> >>> (Was in the moderation queue according to my email, but not Google's
> >>> site. Have forwarded this on. Originally from scriptbox/
> >>> [email protected]
> >>> )
>
> >>> Hello,
>
> >>> For three days I'm facing a very weird problem. I have a script that
> >>> works fine, so I started using Thinking Sphinx to improve
> >>> performance.
> >>> So I installed and added two indexes, as following:
>
> >>> class Category < ActiveRecord::Base
>
> >>> # relation entre les tables
> >>> belongs_to :macrocategory
>
> >>> define_index do
> >>> indexes terms
> >>> end
>
> >>> end
>
> >>> class Dish < ActiveRecord::Base
>
> >>> # Rélation entre les tables
> >>> belongs_to :partner
> >>> has_one :decomposition
> >>> has_many :dish_combos
>
> >>> define_index do
> >>> indexes label
> >>> end
>
> >>> # Named Scopes
> >>> named_scope :get_distinct_macrocategories, :select => 'DISTINCT ON
> >>> (combo_macrocategory) combo_macrocategory'
> >>> named_scope :not_decomposed_dishes, :select => 'id,
> >>> label', :conditions => ['combo_categories IS NULL']
> >>> end
>
> >>> The problem is that everytime I launch the indexing action with rake
> >>> thinking_sphinx:index the first model table is indexed, but not the
> >>> second one. And I got the following output:
>
> >>> Generating Configuration to /Users/jorgegomes/Sites/amv/config/
> >>> development.sphinx.conf
> >>> Sphinx 0.9.9-rc2 (r1785)
> >>> Copyright (c) 2001-2009, Andrew Aksyonoff
>
> >>> using config file '/Users/jorgegomes/Sites/amv/config/
> >>> development.sphinx.conf'...
> >>> indexing index 'category_core'...
> >>> collected 151 docs, 0.0 MB
> >>> collected 0 attr values
> >>> sorted 0.0 Mvalues, 100.0% done
> >>> sorted 0.0 Mhits, 100.0% done
> >>> total 151 docs, 13516 bytes
> >>> total 0.015 sec, 894862 bytes/sec, 9997.35 docs/sec
> >>> distributed index 'category' can not be directly indexed; skipping.
> >>> indexing index 'dish_core'...
> >>> ERROR: index 'dish_core': sql_query_range: : range-query failed:
> >>> ERROR: relation "dishes" does not exist
> >>> (DSN=pgsql://gomesjorge:*...@localhost:5432/amv).
> >>> total 0 docs, 0 bytes
> >>> total 0.061 sec, 0 bytes/sec, 0.00 docs/sec
> >>> distributed index 'dish' can not be directly indexed; skipping.
> >>> indexing index 'macrocategory_core'...
> >>> collected 23 docs, 0.0 MB
> >>> collected 0 attr values
> >>> sorted 0.0 Mvalues, 100.0% done
> >>> sorted 0.0 Mhits, 100.0% done
> >>> total 23 docs, 443 bytes
> >>> total 0.012 sec, 35318 bytes/sec, 1833.69 docs/sec
> >>> distributed index 'macrocategory' can not be directly indexed;
> >>> skipping.
> >>> total 10 reads, 0.000 sec, 13.8 kb/call avg, 0.0 msec/call avg
> >>> total 18 writes, 0.000 sec, 2.3 kb/call avg, 0.0 msec/call avg
>
> >>> But the table exists and the model works fine, can you help please
> >>> I'm
> >>> really stucked in this problem.
>
> >>> Thank you very much!
>
> >>> --
>
> >>> 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
> >>> athttp://groups.google.com/group/thinking-sphinx?hl=en
> >>> .
--
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.