0

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
Vimson
  • 89
  • 2
  • 10
  • possible duplicate of [Some issues with Sphinx and PHP](http://stackoverflow.com/questions/30751138/some-issues-with-sphinx-and-php) – Alex Jun 11 '15 at 08:05
  • I am using RT Index and SphinxQL. I can solve this problem using the query `select * from searchAnalytics limit $offset,$rowsPerPage OPTION max_matches=10000000`. But if we can set this in RT index it will be very helpful. – Vimson Jun 11 '15 at 08:16

1 Answers1

2

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.

barryhunter
  • 20,886
  • 3
  • 30
  • 43