Hi Bob Not entirely sure why this is happening, but your comparison with a SQL query isn't quite accurate - Sphinx matches full words by default (not prefixes/infixes) - so '%value%' is different to 'value'.
If you do want partial word searching, this is covered in the docs: http://freelancing-god.github.com/ts/en/common_issues.html#wildcards Also, you may want to use :star => true to automatically add stars to each word in your search queries (so 'value' is treated as '*value*'). The other way to test this would be to modify the SQL query to match on word boundaries (perhaps using a regular expression?). Let us know if the numbers still aren't matching up then. Cheers -- Pat On 06/10/2010, at 3:42 AM, Bob Sturim wrote: > Thinking Sphinx appears to not be finding all the results I would > expect it to find. > > I have a comments table. The topics table uses single table > inheritance to store comments for both Ideas and Topics...so I am > searching on the entity TopicComment. > > My defines_index declaration in TopicComment.rb is: > > define_index do > indexes body > has created_at, updated_at > set_property :delta => true > end > > If I do the following: > > TopicComment.search('value') > > it will only find 6 hits...though if I go into sql and issue the > following query: > > SELECT * FROM comments > where type = 'TopicComment' > and body like '%value%' > order by topic_id > > it will retrieve 377 hits. > > There are 4141 entires in the comments table that are of type > TopicComments. If I rebuild my index using > > rake ts:rebuild > > it shows that 4141 documents were indexed: > > > indexing index 'topic_comment_core'... > collected 4141 docs, 2.9 MB > sorted 12.5 Mhits, 100.0% done > total 4141 docs, 2940976 bytes > total 8.233 sec, 357181 bytes/sec, 502.92 docs/sec > indexing index 'topic_comment_delta'... > collected 0 docs, 0.0 MB > total 0 docs, 0 bytes > total 0.001 sec, 0 bytes/sec, 0.00 docs/sec > skipping non-plain index 'topic_comment'... > > My sphinx.yml is defined as follows: > > > production: > enable_star: 1 > min_infix_len: 1 > max_matches: 5000 > morphology: stem_en > > > Am I missing something? > > Thanks very much. > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > 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/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. 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/thinking-sphinx?hl=en.
