{"action":"created","issue":{"url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/67","repository_url":"https://api.github.com/repos/manticoresoftware/manticoresearch","labels_url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/67/comments","events_url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/67/events","html_url":"https://github.com/manticoresoftware/manticoresearch/issues/67","id":307187513,"number":67,"title":"Error: \"ranking expression must evaluate to integer or float\" when used CEIL() in ranker expression","user":{"login":"isqad","id":751651,"avatar_url":"https://avatars2.githubusercontent.com/u/751651?v=4","gravatar_id":"","url":"https://api.github.com/users/isqad","html_url":"https://github.com/isqad","followers_url":"https://api.github.com/users/isqad/followers","following_url":"https://api.github.com/users/isqad/following{/other_user}","gists_url":"https://api.github.com/users/isqad/gists{/gist_id}","starred_url":"https://api.github.com/users/isqad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isqad/subscriptions","organizations_url":"https://api.github.com/users/isqad/orgs","repos_url":"https://api.github.com/users/isqad/repos","events_url":"https://api.github.com/users/isqad/events{/privacy}","received_events_url":"https://api.github.com/users/isqad/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-21T10:24:25Z","updated_at":"2018-03-21T16:16:32Z","closed_at":"2018-03-21T16:16:32Z","author_association":"NONE","body":"Hello!\r\n\r\nI've got error in simple query:\r\n```sql\r\nSELECT sphinx_internal_id,WEIGHT() AS relevance FROM product WHERE MATCH('gas stove') AND sphinx_deleted=0 AND state IN (1,2,3,5) AND public_state=1  ORDER BY weight() desc LIMIT 0,1\r\n OPTION max_matches=5000, \r\nranker=expr('sum((900*(word_count*user_weight))+(30*lcs)+(30-CEIL(LOG10(min_best_span_pos+1)*10))+exact_hit)'), retry_delay=0;\r\n```\r\n\r\n```\r\nerror=index product: ranking expression must evaluate to integer or float\r\n```\r\n\r\nI found that expression should be of `SPH_ATTR_INTEGER` type\r\nhttps://github.com/manticoresoftware/manticoresearch/blob/master/src/sphinxsearch.cpp#L8468\r\n\r\nAdditionaly I found that returned type of CEIL is SPH_ATTR_BIGINT\r\nhttps://github.com/manticoresoftware/manticoresearch/blob/master/src/sphinxexpr.cpp#L2466\r\nIt was added in early version of sphinx, \r\nhttps://github.com/sphinxsearch/sphinx/blob/master/src/sphinxexpr.cpp#L2268\r\nbut in in sphinx v2.2 it was `SPH_ATTR_INTEGER` type\r\nhttps://github.com/sphinxsearch/sphinx/blob/rel22/src/sphinxexpr.cpp#L1777\r\n\r\nMay be condition should be correct and check for `SPH_ATTR_BIGINT` instead `SPH_ATTR_INTEGER` ?\r\n```\r\nif ( m_eExprType!=SPH_ATTR_BIGINT && m_eExprType!=SPH_ATTR_FLOAT )\r\n```\r\n\r\nRegard, Andrew.\r\n"},"comment":{"url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/comments/375001552","html_url":"https://github.com/manticoresoftware/manticoresearch/issues/67#issuecomment-375001552","issue_url":"https://api.github.com/repos/manticoresoftware/manticoresearch/issues/67","id":375001552,"user":{"login":"isqad","id":751651,"avatar_url":"https://avatars2.githubusercontent.com/u/751651?v=4","gravatar_id":"","url":"https://api.github.com/users/isqad","html_url":"https://github.com/isqad","followers_url":"https://api.github.com/users/isqad/followers","following_url":"https://api.github.com/users/isqad/following{/other_user}","gists_url":"https://api.github.com/users/isqad/gists{/gist_id}","starred_url":"https://api.github.com/users/isqad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isqad/subscriptions","organizations_url":"https://api.github.com/users/isqad/orgs","repos_url":"https://api.github.com/users/isqad/repos","events_url":"https://api.github.com/users/isqad/events{/privacy}","received_events_url":"https://api.github.com/users/isqad/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T16:16:32Z","updated_at":"2018-03-21T16:16:32Z","author_association":"NONE","body":"Thanks! "}}
{"actor":{"display_login":"isqad"}}