sphinx

운영자 | 기사입력 2014/01/12 [07:43]
>
필자의 다른기사 보기 인쇄하기 메일로 보내기 글자 크게 글자 작게
sphinx
 
운영자   기사입력  2014/01/12 [07:43]
 

cd sphinx-2.1.4-release


./configure --prefix=/home/sphinx
make
make install

cp /home/sphinx/etc/sphinx.conf.dist  /home/sphinx/etc/sphinx.conf


=============================================================
sphinx.conf  편집
sql_host                = localhost
        sql_user                = root
        sql_pass                =123456
        sql_db                  = test
        sql_port                = 3306  # optional, default is 3306


===============================================================


./indexer --all


./searchd 

================================================
mysql -h0 -P9306 

mysql -h192.168.0.1  -P9306 
======================================
9306 포트가 다 열리고 아이디 패스없이 접속 가능하기 때문에
 포트 차단 해야 하구 필요한 곳만 열어야 함 


where match('"감자"  "고구마"')


where match('@title"감자"')


where match('@(title,body) "감자"')


$sql2_where="WHERE \
MATCH('@body\"$search_key\" @section\"$search_section\" ')";


where match('"감자"  "고구마"')  OPTION FIELD_WEIGHTS=(title=2,body=1);


where match('@id  abc')


where match('@id  *abc')
(index  에
enable_star=1
min_infix_len=2

)



===================================================================
CREATE TABLE sph_counter
(    counter_id INTEGER PRIMARY KEY NOT NULL,
     max_doc_id INTEGER NOT NULL
);
# in sphinx.confsource main
{    
# ...    
sql_query_pre = SET NAMES utf8    
sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM documents    
sql_query = SELECT id, title, body FROM documents \  
      WHERE id<=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
}
 
source delta : main
{    
 
sql_query_pre = SET NAMES utf8    
sql_query = SELECT id, title, body FROM documents \ 
       WHERE id>( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )
}
 
index main
{    
   source = main    
   path = /path/to/main   
 # ... all the other settings
}
 
# note how all other settings are copied from main,
# but source and path are overridden (they MUST be)
 
index delta : main
{   
  source = delta    
  path = /path/to/delta
}
===========================================================



/home/sphinx/bin/indexer -c /home/sphinx/etc/sphinx.conf --all

 


home/sphinx/bin/indexer -c /home/sphinx/etc/sphinx.conf --all
Sphinx 2.1.4-release (rel21-r4421)
Copyright (c) 2001-2013, Andrew Aksyonoff
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)

 

using config file '/home/sphinx/etc/sphinx.conf'...
indexing index 'breaknews_com'...
collected 381010 docs, 1430.4 MB
sorted 377.0 Mhits, 100.0% done
total 381010 docs, 1430409814 bytes
total 323.673 sec, 4419302 bytes/sec, 1177.14 docs/sec
indexing index 'delta2'...
FATAL: failed to lock /home/sphinx/var/data/breaknews_dalta.spl: Resource temporarily unavailable, will not index. Try --rotate option.

 


/home/sphinx/bin/indexer --config /home/sphinx/etc/sphinx.conf --rotate breaknews_com

 

 
///////////////////////////
전체 업데이트

 /home/sphinx/bin/indexer --all --rotate

/////////////////////////////////////////////////////
delta 업데이트 업데이트
--merge 로 합
 

/home/sphinx/bin/indexer delta --rotate
sleep 20
/home/sphinx/bin/indexer --merge newsview_kr delta --rotate
sleep 20;
/home/sphinx/bin/searchd --stop
sleep 10;
/home/sphinx/bin/searchd

 

 
트위터 트위터 페이스북 페이스북 카카오톡 카카오톡
기사입력: 2014/01/12 [07:43]  최종편집: ⓒ iwav