Hello, I'm not an experienced sphinx user, so maybe I'm just doing something 
completely wrong then sorry for dumb question.

My sphinx version is: Sphinx 0.9.9-release (r2117)

I want to have an MVA attr in my index to filter by it. Here is a part of my 
config:

-- cut --
source post_core_0
{
  type = pgsql
  sql_host = localhost
  sql_user = postgres
  sql_pass = postgres
  sql_db = musicus_development
  sql_query_pre = SET TIME ZONE 'UTC'
  sql_query = SELECT "posts"."id" * 9::INT8 + 5 AS "id" , "posts"."title" AS 
"title", "posts"."preface" AS "preface", "posts"."body" AS "body", 
"posts"."status" AS "status", "posts"."id" AS "sphinx_internal_id", 0 AS 
"sphinx_deleted", 4206412723 AS "class_crc", "posts"."blog_id" AS "blog_id", 
cast(extract(epoch from "posts"."created_at") as int) AS "created_at", 
cast(extract(epoch from "posts"."updated_at") as int) AS "updated_at", 
cast(extract(epoch from "posts"."published_at") as int) AS "published_at", 
cast(extract(epoch from "posts"."publish_at") as int) AS "publish_at", 
cast(extract(epoch from "posts"."deleted_at") as int) AS "deleted_at", 
"blogs"."site_id" AS "site_id" FROM "posts" LEFT OUTER JOIN "blogs" ON 
"blogs"."id" = "posts"."blog_id" WHERE ("posts"."id" >= $start AND 
"posts"."id" <= $end AND status = 'published') GROUP BY "posts"."id", 
"posts"."title", "posts"."preface", "posts"."body", "posts"."status", 
"posts"."id", "posts"."blog_id", "posts"."created_at", "posts"."updated_at", 
"posts"."published_at", "posts"."publish_at", "posts"."deleted_at", 
"blogs"."site_id"
  sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), 
COALESCE(MAX("id"), 1::bigint) FROM "posts" 
  sql_attr_uint = sphinx_internal_id
  sql_attr_uint = sphinx_deleted
  sql_attr_uint = class_crc
  sql_attr_uint = blog_id
  sql_attr_uint = site_id
  sql_attr_timestamp = created_at
  sql_attr_timestamp = updated_at
  sql_attr_timestamp = published_at
  sql_attr_timestamp = publish_at
  sql_attr_timestamp = deleted_at
  sql_attr_multi = uint tag from query; SELECT posts.id AS id, blogs.site_id 
AS tag FROM blogs, posts WHERE blogs.id = posts.blog_id
  sql_query_info = SELECT * FROM "posts" WHERE "id" = (($id - 5) / 9)
}

index post_core
{
  source = post_core_0
  path = /Users/tukan/xxx/musicus/db/sphinx/development/post_core
  morphology = stem_enru
  min_word_len = 2
  charset_type = utf-8
  min_infix_len = 2
  enable_star = 1
  html_strip = 1
}

index post
{
  type = distributed
  local = post_core
}

-- cut --

The query for the tag attr is simplified but it is real. I reindex all my 
stuff using: indexer --config config/development.sphinx.conf --all --rotate

Let's assume I have a post titled 'mmm' with blog.site_id = 1 (I want to see 
this value in the tag attr in my index):

-- cut --
SELECT posts.title, posts.id AS id, blogs.site_id AS tag FROM blogs, posts 
WHERE blogs.id = posts.blog_id AND posts.id = 1462
;
 title |  id  | tag 
-------+------+-----
 mmm   | 1462 |   1
-- cut --

So I run search: 
search "mmm" --config config/development.sphinx.conf     

And it returns: 
-- cut --
displaying matches:
1. document=13163, weight=3, sphinx_internal_id=1462, sphinx_deleted=0, 
class_crc=4206412723, blog_id=1, created_at=Fri Sep 23 03:57:50 2011, 
updated_at=Fri Sep 23 03:57:50 2011, published_at=Thu Jan  1 03:00:00 1970, 
publish_at=Thu Jan  1 03:00:00 1970, deleted_at=Thu Jan  1 03:00:00 1970, 
site_id=1, tag=()
-- cut --

As you can see the tag attr is empty. Why so?

Also I turned on query logging in my postgres config and 'SELECT posts.id AS 
id, blogs.site_id AS tag FROM blogs, posts WHERE blogs.id = posts.blog_id' 
query appears there after i run indexer. 

Also I tried 'ranged-query':

sql_attr_multi = uint tag from ranged-query; SELECT posts.id AS id, 
blogs.site_id AS tag FROM blogs, posts WHERE blogs.id = posts.blog_id AND 
"posts"."id" >= $start AND "posts"."id" <= $end

But indexer prints out: 

ERROR: source 'post_core_0': unexpected end of line in sql_attr_multi.
ERROR: index 'post_core': failed to configure some of the sources, will not 
index.

And I can't understand why and what I'm doing wrong (I tried to look at 
sphinx config parser sources and haven't figured out what I'm doing wrong).

Can anyone help me or suggest how to figure out what's going on and how to 
fix it.


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/e-wV9SIIJ38J.
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/sphinx-dev?hl=en.

Reply via email to