Sphinx RT Index - Is there any way to set max_matches in Index definition

555 Views Asked by At

I am using SphinxQL for querying RT Index and it contains multi million records. My problem is when i tried to query second page of result set

$searches = $prepStatement->query("select * from searchAnalytics limit $offset,$rowsPerPage")->execute();

it throws the error

offset out of bounds (offset=1000, max_matches=1000) [ select * from searchAnalytics limit 1000,1000]

Can somebody please help me to get out of this problem? Is there any way to set max_matches in Index definition?

My index is

type = rt
rt_mem_limit = 1024M
path = /Users/vimson/projects/sphinx/data/searchAnalytics

rt_attr_string = SessionId
rt_attr_timestamp = Time
rt_field = Query
rt_attr_string = Query
rt_field = SearchLocation
rt_attr_string = SearchLocation
rt_attr_uint = Location
rt_attr_uint = CourseType
rt_attr_uint = SearchType
rt_attr_uint = CourseCount
rt_attr_multi = Courses
1

There are 1 best solutions below

0
On BEST ANSWER

You need to set query time with OPTION as noted in comments.

(There used to be one in the 'searchd' section of the config file (not per index) - but it just applied a cap, would still need to use the query time parameter anyway)

Note its best to set it dynamically...

$max = max(1000,$offset+$rowsPerPage+300);
$qu = "... limit $offset,$rowsPerPage OPTION max_matches=$max";

rather than just setting a stupidly high number.