Guest User

Untitled

a guest
Aug 6th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. How to Install Sphinx on LINUX(ubuntu)
  2. root@dev2:/# search "test"
  3. Sphinx 0.9.9-release (r2117)
  4. Copyright (c) 2001-2009, Andrew Aksyonoff
  5.  
  6. using config file '/etc/sphinxsearch/sphinx.conf'...
  7. index 'test1': query 'test ': returned 3 matches of 3 total in 0.000 sec
  8.  
  9. displaying matches:
  10. 1. document=1, weight=2, group_id=1, date_added=Thu Jan 5 18:18:55 2012
  11. id=1
  12. group_id=1
  13. group_id2=5
  14. date_added=2012-01-05 18:18:55
  15. title=test one
  16. content=this is my test document number one. also checking search within phrases.
  17. 2. document=2, weight=2, group_id=1, date_added=Thu Jan 5 18:18:55 2012
  18. id=2
  19. group_id=1
  20. group_id2=6
  21. date_added=2012-01-05 18:18:55
  22. title=test two
  23. content=this is my test document number two
  24. 3. document=4, weight=1, group_id=2, date_added=Thu Jan 5 18:18:55 2012
  25. id=4
  26. group_id=2
  27. group_id2=8
  28. date_added=2012-01-05 18:18:55
  29. title=doc number four
  30. content=this is to test groups
  31.  
  32. words:
  33. 1. 'test': 3 documents, 5 hits
  34.  
  35. source src1
  36. {
  37. type = mysql
  38. sql_host = localhost
  39. sql_user = user
  40. sql_pass = pwd
  41. sql_db = test
  42. sql_port = 3306 # optional, default is 3306
  43. sql_query =
  44. SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content
  45. FROM documents
  46. sql_attr_uint = group_id
  47. sql_attr_timestamp = date_added
  48. sql_query_info = SELECT * FROM documents WHERE id=$id
  49. }
  50.  
  51. index test1
  52. {
  53. source = src1
  54. path = /var/lib/sphinxsearch/data/test1
  55. docinfo = extern
  56. charset_type = sbcs
  57. }
  58.  
  59. indexer
  60. {
  61. mem_limit = 32M
  62. }
  63.  
  64. searchd
  65. {
  66. port = 9312
  67. log = /var/log/sphinxsearch/searchd.log
  68. query_log = /var/log/sphinxsearch/query.log
  69. read_timeout = 5
  70. max_children = 30
  71. pid_file = /var/run/searchd.pid
  72. max_matches = 1000
  73. seamless_rotate = 1
  74. preopen_indexes = 0
  75. unlink_old = 1
  76. }
  77.  
  78. require_once('sphinxapi.php');
  79. //require_once('api/sphinxapi.php');
  80. $s = new SphinxClient;
  81. $s->setServer("123.123.123.123", 9312); // NOT "localhost" under Windows 7!
  82. $s->setMatchMode(SPH_MATCH_EXTENDED2);
  83.  
  84. $result = $s->Query("group");
  85.  
  86. echo '<pre>';print_r($result);
  87.  
  88. {"status":"failed","status_message":"connection to localhost:9312 failed (errno=10060, msg=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)"}
  89.  
  90. /path/to/searchd --config /etc/sphinxsearch/sphinx.conf
  91.  
  92. searchd --config /etc/sphinxsearch/sphinx.conf
  93.  
  94. $s->setServer("123.123.123.123", 9312); // NOT "localhost" under Windows 7!
Add Comment
Please, Sign In to add comment