Rafiu
Rafiu

Reputation: 4960

Sphinx search query result differs with Active record

I am using sphinx in my application and its configuration is

Thinking sphinx - 1.3.17

Active Record - 2.3.5

After Commit - 1.0.10

Riddle - 1.0.10

Thinking sphinx Raspell - 1.1.1

Raspell -1.3

I have added index for a field name in a table. And i search with the text "sony" which gives 20 record as results.

Sphinx result: Sphinx Querying: 'sony'

Sphinx (0.004703s) Found 43 results

Company Load (1.2ms) SELECT * FROM "companies" WHERE ("companies."id" IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,43,64,83,91))

In here Sphinx (0.004703s) Found 43 results but in the sql it has only 20 ids in it . because of this it gives 20 records as result.

If i search the same table using active record using "LIKE" (where lower(name) LIKE '%sony%') produces 43 records as result.

why sphinx produce lesser results?

please reply..

Upvotes: 0

Views: 358

Answers (1)

Ariejan
Ariejan

Reputation: 11079

Sphinx will return at most 1,000 results and paginate them by default at 20 items per page. You can over come his:

Article.search 'pancakes', :per_page => 100

Upvotes: 1

Related Questions