Sphinx 2.0.4-Release Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
28/03/12 Sphinx | Open Source Search Server Sphinx 2.0.4-release reference manual Free open-source SQL full-text search engine Copyright © 2001-2012 Andrew Aksyonoff Copyright © 2008-2012 Sphinx Technologies Inc, http://sphinxsearch.com Table of Contents 1. Introduction 1.1. About 1.2. Sphinx features 1.3. Where to get Sphinx 1.4. License 1.5. Credits 1.6. History 2. Installation 2.1. Supported systems 2.2. Required tools 2.3. Installing Sphinx on Linux 2.4. Installing Sphinx on Windows 2.5. Known installation issues 2.6. Quick Sphinx usage tour 3. Indexing 3.1. Data sources 3.2. Full-text fields 3.3. Attributes 3.4. MVA (multi-valued attributes) 3.5. Indexes 3.6. Restrictions on the source data 3.7. Charsets, case folding, and translation tables 3.8. SQL data sources (MySQL, PostgreSQL) 3.9. xmlpipe data source 3.10. xmlpipe2 data source 3.11. Live index updates 3.12. Delta index updates 3.13. Index merging 4. Real-time indexes 4.1. RT indexes overview 4.2. Known caveats with RT indexes 4.3. RT index internals 4.4. Binary logging 5. Searching 5.1. Matching modes 5.2. Boolean query syntax 5.3. Extended query syntax 5.4. Search results ranking 5.5. Expressions, functions, and operators 5.5.1. Operators 5.5.2. Numeric functions 5.5.3. Date and time functions 5.5.4. Type conversion functions 5.5.5. Comparison functions 5.5.6. Miscellaneous functions 5.6. Sorting modes 5.7. Grouping (clustering) search results 5.8. Distributed searching 5.9. searchd query log formats 5.9.1. Plain log format 5.9.2. SphinxQL log format 5.10. MySQL protocol support and SphinxQL 5.11. Multi-queries 5.12. Collations sphinxsearch.com/docs/current.html 1/130 28/03/12 Sphinx | Open Source Search Server 5.13. User-defined functions (UDF) 6. Command line tools reference 6.1. indexer command reference 6.2. searchd command reference 6.3. search command reference 6.4. spelldump command reference 6.5. indextool command reference 7. SphinxQL reference 7.1. SELECT syntax 7.2. SHOW META syntax 7.3. SHOW WARNINGS syntax 7.4. SHOW STATUS syntax 7.5. INSERT and REPLACE syntax 7.6. DELETE syntax 7.7. SET syntax 7.8. SET TRANSACTION syntax 7.9. BEGIN, COMMIT, and ROLLBACK syntax 7.10. CALL SNIPPETS syntax 7.11. CALL KEYWORDS syntax 7.12. SHOW TABLES syntax 7.13. DESCRIBE syntax 7.14. CREATE FUNCTION syntax 7.15. DROP FUNCTION syntax 7.16. SHOW VARIABLES syntax 7.17. SHOW COLLATION syntax 7.18. UPDATE syntax 7.19. ATTACH INDEX syntax 7.20. FLUSH RTINDEX syntax 7.21. Multi-statement queries 7.22. Comment syntax 7.23. List of SphinxQL reserved keywords 7.24. SphinxQL upgrade notes, version 2.0.1-beta 8. API reference 8.1. General API functions 8.1.1. GetLastError 8.1.2. GetLastWarning 8.1.3. SetServer 8.1.4. SetRetries 8.1.5. SetConnectTimeout 8.1.6. SetArrayResult 8.1.7. IsConnectError 8.2. General query settings 8.2.1. SetLimits 8.2.2. SetMaxQueryTime 8.2.3. SetOverride 8.2.4. SetSelect 8.3. Full-text search query settings 8.3.1. SetMatchMode 8.3.2. SetRankingMode 8.3.3. SetSortMode 8.3.4. SetWeights 8.3.5. SetFieldWeights 8.3.6. SetIndexWeights 8.4. Result set filtering settings 8.4.1. SetIDRange 8.4.2. SetFilter 8.4.3. SetFilterRange 8.4.4. SetFilterFloatRange 8.4.5. SetGeoAnchor 8.5. GROUP BY settings 8.5.1. SetGroupBy 8.5.2. SetGroupDistinct 8.6. Querying 8.6.1. Query sphinxsearch.com/docs/current.html 2/130 28/03/12 Sphinx | Open Source Search Server 8.6.2. AddQuery 8.6.3. RunQueries 8.6.4. ResetFilters 8.6.5. ResetGroupBy 8.7. Additional functionality 8.7.1. BuildExcerpts 8.7.2. UpdateAttributes 8.7.3. BuildKeywords 8.7.4. EscapeString 8.7.5. Status 8.7.6. FlushAttributes 8.8. Persistent connections 8.8.1. Open 8.8.2. Close 9. MySQL storage engine (SphinxSE) 9.1. SphinxSE overview 9.2. Installing SphinxSE 9.2.1. Compiling MySQL 5.0.x with SphinxSE 9.2.2. Compiling MySQL 5.1.x with SphinxSE 9.2.3. Checking SphinxSE installation 9.3. Using SphinxSE 9.4. Building snippets (excerpts) via MySQL 10. Reporting bugs 11. sphinx.conf options reference 11.1. Data source configuration options 11.1.1. type 11.1.2. sql_host 11.1.3. sql_port 11.1.4. sql_user 11.1.5. sql_pass 11.1.6. sql_db 11.1.7. sql_sock 11.1.8. mysql_connect_flags 11.1.9. mysql_ssl_cert, mysql_ssl_key, mysql_ssl_ca 11.1.10. odbc_dsn 11.1.11. sql_query_pre 11.1.12. sql_query 11.1.13. sql_joined_field 11.1.14. sql_query_range 11.1.15. sql_range_step 11.1.16. sql_query_killlist 11.1.17. sql_attr_uint 11.1.18. sql_attr_bool 11.1.19. sql_attr_bigint 11.1.20. sql_attr_timestamp 11.1.21. sql_attr_str2ordinal 11.1.22. sql_attr_float 11.1.23. sql_attr_multi 11.1.24. sql_attr_string 11.1.25. sql_attr_str2wordcount 11.1.26. sql_column_buffers 11.1.27. sql_field_string 11.1.28. sql_field_str2wordcount 11.1.29. sql_file_field 11.1.30. sql_query_post 11.1.31. sql_query_post_index 11.1.32. sql_ranged_throttle 11.1.33. sql_query_info 11.1.34. xmlpipe_command 11.1.35. xmlpipe_field 11.1.36. xmlpipe_field_string 11.1.37. xmlpipe_field_wordcount 11.1.38. xmlpipe_attr_uint 11.1.39. xmlpipe_attr_bigint 11.1.40. xmlpipe_attr_bool 11.1.41. xmlpipe_attr_timestamp 11.1.42. xmlpipe_attr_str2ordinal 11.1.43. xmlpipe_attr_float 11.1.44. xmlpipe_attr_multi sphinxsearch.com/docs/current.html 3/130 28/03/12 Sphinx | Open Source Search Server 11.1.45. xmlpipe_attr_multi_64 11.1.46. xmlpipe_attr_string 11.1.47. xmlpipe_fixup_utf8 11.1.48. mssql_winauth 11.1.49. mssql_unicode 11.1.50. unpack_zlib 11.1.51. unpack_mysqlcompress 11.1.52. unpack_mysqlcompress_maxsize 11.2. Index configuration options 11.2.1. type 11.2.2. source 11.2.3. path 11.2.4. docinfo 11.2.5. mlock 11.2.6. morphology 11.2.7. dict 11.2.8. index_sp 11.2.9. index_zones 11.2.10. min_stemming_len 11.2.11. stopwords 11.2.12. wordforms 11.2.13. exceptions 11.2.14. min_word_len 11.2.15. charset_type 11.2.16. charset_table 11.2.17. ignore_chars 11.2.18. min_prefix_len 11.2.19. min_infix_len 11.2.20. prefix_fields 11.2.21. infix_fields 11.2.22. enable_star 11.2.23. ngram_len 11.2.24. ngram_chars 11.2.25. phrase_boundary 11.2.26. phrase_boundary_step 11.2.27. html_strip 11.2.28. html_index_attrs 11.2.29. html_remove_elements 11.2.30. local 11.2.31. agent 11.2.32. agent_blackhole 11.2.33. agent_connect_timeout 11.2.34. agent_query_timeout 11.2.35. preopen 11.2.36. ondisk_dict 11.2.37. inplace_enable 11.2.38. inplace_hit_gap 11.2.39. inplace_docinfo_gap 11.2.40. inplace_reloc_factor 11.2.41. inplace_write_factor 11.2.42. index_exact_words 11.2.43. overshort_step 11.2.44. stopword_step 11.2.45. hitless_words 11.2.46. expand_keywords 11.2.47. blend_chars 11.2.48. blend_mode 11.2.49. rt_mem_limit 11.2.50. rt_field 11.2.51. rt_attr_uint 11.2.52. rt_attr_bigint 11.2.53. rt_attr_float 11.2.54. rt_attr_multi 11.2.55. rt_attr_multi_64 11.2.56. rt_attr_timestamp 11.2.57. rt_attr_string 11.3. indexer program configuration options 11.3.1. mem_limit 11.3.2. max_iops 11.3.3. max_iosize 11.3.4. max_xmlpipe2_field 11.3.5. write_buffer 11.3.6. max_file_field_buffer 11.3.7. on_file_field_error sphinxsearch.com/docs/current.html 4/130 28/03/12 Sphinx | Open Source Search Server 11.4. searchd program configuration options 11.4.1. listen 11.4.2. address 11.4.3. port 11.4.4. log 11.4.5. query_log 11.4.6. query_log_format 11.4.7. read_timeout 11.4.8. client_timeout 11.4.9. max_children 11.4.10. pid_file 11.4.11. max_matches 11.4.12. seamless_rotate 11.4.13. preopen_indexes 11.4.14. unlink_old 11.4.15. attr_flush_period 11.4.16. ondisk_dict_default 11.4.17. max_packet_size 11.4.18. mva_updates_pool 11.4.19. crash_log_path 11.4.20. max_filters 11.4.21. max_filter_values 11.4.22. listen_backlog 11.4.23. read_buffer 11.4.24. read_unhinted 11.4.25. max_batch_queries 11.4.26. subtree_docs_cache 11.4.27. subtree_hits_cache 11.4.28. workers 11.4.29. dist_threads 11.4.30. binlog_path 11.4.31. binlog_flush 11.4.32. binlog_max_log_size 11.4.33. collation_server 11.4.34. collation_libc_locale 11.4.35. plugin_dir 11.4.36. mysql_version_string 11.4.37. rt_flush_period 11.4.38. thread_stack 11.4.39. expansion_limit 11.4.40. compat_sphinxql_magics 11.4.41. watchdog 11.4.42. prefork_rotation_throttle A. Sphinx revision history A.1. Version 2.0.4-release, 02 mar 2012 A.2. Version 2.0.3-release, 23 dec 2011 A.3. Version 2.0.2-beta, 15 nov 2011 A.4. Version 2.0.1-beta, 22 apr 2011 A.5. Version 1.10-beta, 19 jul 2010 A.6. Version 0.9.9-release, 02 dec 2009 A.7. Version 0.9.9-rc2, 08 apr 2009 A.8. Version 0.9.9-rc1, 17 nov 2008 A.9. Version 0.9.8.1, 30 oct 2008 A.10. Version 0.9.8, 14 jul 2008 A.11. Version 0.9.7, 02 apr 2007 A.12. Version 0.9.7-rc2, 15 dec 2006 A.13. Version 0.9.7-rc1, 26 oct 2006 A.14. Version 0.9.6, 24 jul 2006 A.15. Version 0.9.6-rc1, 26 jun 2006 List of Examples 3.1. Ranged query usage example 3.2. XMLpipe document stream 3.3. xmlpipe2 document stream 3.4. Fully automated live updates 4.1.