주소 데이터를 DB에 모두 입력하셨다면 이제 인덱싱 작업을 위한 Sphinx 설정을 해야합니다.
설치 가이드대로 설치를 하셨다면 Sphinx의 설정파일 경로는 /usr/local/sphinx/etc/sphinx.conf 입니다.
처음 설치하고 나면 sphinx.conf 파일은 없을 수도 있으며 sphinx.conf.dist 와 같은 예제 파일을 제공합니다.
아래는 juso.sir.co.k Sphinx 서버 sphinx.conf 파일의 내용입니다.
[code]
#
# Minimal Sphinx configuration sample (clean, simple, functional)
#
source dorodata
{
type = mysql
sql_host = localhost
sql_user = juso
sql_pass = juso1234
sql_db = juso
sql_port = 3306 # optional, default is 3306
sql_query_pre = SET NAMES utf8
sql_query = \
SELECT sn as id, sn, sido, gugun, beopname, ri, san, jibon, jibu, doroname, jiha, geonbon, geonbu, geonname, geonsangse, haengjeong, zipcode, daryang, geonname2, CONCAT_WS(' ', doroname, IF(jiha=1, '지하', ''), CONCAT(geonbon, IF(geonbu=0, '', '-'), IF(geonbu=0, '', geonbu)), geonname, geonsangse, daryang, geonname2) as doro, CONCAT_WS(' ', beopname, haengjeong, ri, IF(san=1, '산', ''), CONCAT(jibon, IF(jibu=0, '', '-'), IF(jibu=0, '', jibu))) as jibeon \
FROM dorodata \
ORDER BY sn asc
sql_attr_uint = sn
sql_field_string = zipcode
sql_field_string = sido
sql_field_string = gugun
sql_field_string = doroname
sql_field_string = geonbon
sql_field_string = geonbu
sql_field_string = geonname
sql_field_string = geonsangse
sql_field_string = beopname
sql_field_string = haengjeong
sql_field_string = ri
sql_field_string = san
sql_field_string = jiha
sql_field_string = jibon
sql_field_string = jibu
sql_field_string = doro
sql_field_string = jibeon
sql_field_string = daryang
sql_field_string = geonname2
#sql_query_info = SELECT * FROM documents WHERE id=$id
}
index dorodata
{
source = dorodata
path = /usr/local/sphinx/var/data/dorodata
docinfo = extern
enable_star = 1
min_infix_len = 1
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
ngram_len = 1
ngram_chars = U+4E00..U+9FBB, U+3400..U+4DB5, U+20000..U+2A6D6, U+FA0E, U+FA0F, U+FA11, U+FA13, U+FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27, U+FA28, U+FA29, U+3105..U+312C, U+31A0..U+31B7, U+3041, U+3043, U+3045, U+3047, U+3049, U+304B, U+304D, U+304F, U+3051, U+3053, U+3055, U+3057, U+3059, U+305B, U+305D, U+305F, U+3061, U+3063, U+3066, U+3068, U+306A..U+306F, U+3072, U+3075, U+3078, U+307B, U+307E..U+3083, U+3085, U+3087, U+3089..U+308E, U+3090..U+3093, U+30A1, U+30A3, U+30A5, U+30A7, U+30A9, U+30AD, U+30AF, U+30B3, U+30B5, U+30BB, U+30BD, U+30BF, U+30C1, U+30C3, U+30C4, U+30C6, U+30CA, U+30CB, U+30CD, U+30CE, U+30DE, U+30DF, U+30E1, U+30E2, U+30E3, U+30E5, U+30E7, U+30EE, U+30F0..U+30F3, U+30F5, U+30F6, U+31F0, U+31F1, U+31F2, U+31F3, U+31F4, U+31F5, U+31F6, U+31F7, U+31F8, U+31F9, U+31FA, U+31FB, U+31FC, U+31FD, U+31FE, U+31FF, U+AC00..U+D7A3, U+1100..U+1159, U+1161..U+11A2, U+11A8..U+11F9, U+A000..U+A48C, U+A492..U+A4C6
}
index testrt
{
type = rt
rt_mem_limit = 32M
path = /usr/local/sphinx/var/data/testrt
charset_type = utf-8
rt_field = title
rt_field = content
rt_attr_uint = gid
}
indexer
{
mem_limit = 1536M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /usr/local/sphinx/var/log/searchd.log
query_log = /usr/local/sphinx/var/log/query.log
read_timeout = 5
max_children = 30
pid_file = /usr/local/sphinx/var/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /usr/local/sphinx/var/data
}
[/code]
설정 파일의 내용을 간단히 설명해 보겠습니다. 저도 잘 모르기 때문에 간단히 설명할 수 밖에 없습니다. ^^;
먼저 source dorodata 설정 블럭에서 sql_host 등의 정보를 DB 테이블 정보에 맞게 수정해주셔야합니다.
이 정보를 가지고 sphinx 에서 DB에 접속에 주소 데이트를 인덱싱하기 때문입니다. 또한 sql_field_string 등의
sphinx Attribute를 이용해 주소 데이터를 필드를 각각 인덱싱되도록 했습니다. 이렇게 한 이유는 DB 서버없이
주소 검색을 처리하기 위해서입니다. Attribute 관련 내용은 http://sphinxsearch.com/docs/archives/2.1.4/attributes.html 를 참고하세요.
다음으로 index dorodata 설정 블럭은 데이터를 인덱싱할 때 어떻게 처리를 할지를 정하는 부분입니다.
source = dorodata 부분은 위에서 설정한 source dorodata 설정 블럭을 사용한다는 의미입니다. 한글 인덱싱을
위해 charset_table, ngram_len 와 ngram_chars 설정을 추가했습니다. ngram_chars 설정 값은 utf-8 일 때입니다.
그외 설정에 대해서는 http://sphinxsearch.com/docs/archives/2.1.4/indexing.html 를 참고하세요.
indexer 설정 블럭에서 mem_limit 를 1536M 로 설정했으며 이 설정은 메모리가 충분하다면 크게 잡아서
인덱싱을 좀 더 빨리 처리할 수 있습니다. searchd 설정은 인덱싱한 데이터를 실제 검색하는 엔진에 대한
설정입니다. listen 부분은 포트를 설정하는 것으로 기본은 9312 입니다. max_matches 설정은 검색 결과를
최대 몇개까지 표시할 것인가를 결정하는 것입니다. 인덱싱 속도는 서버 사양에 영향을 받습니다.
추가적인 설정과 인덱싱 관련자료는 http://sphinxsearch.com/docs/archives/2.1.4/ 를 참고하세요.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7030 | 11년 전 | 1413 | ||
| 7029 |
|
11년 전 | 3247 | |
| 7028 |
|
11년 전 | 1143 | |
| 7027 | 11년 전 | 1009 | ||
| 7026 | 11년 전 | 2087 | ||
| 7025 |
어려워요잉
|
11년 전 | 2744 | |
| 7024 | 11년 전 | 2105 | ||
| 7023 | 11년 전 | 3135 | ||
| 7022 |
Shhhh
|
11년 전 | 1531 | |
| 7021 |
|
11년 전 | 3275 | |
| 7020 | 11년 전 | 794 | ||
| 7019 |
막돼먹은영애
|
11년 전 | 1087 | |
| 7018 | 11년 전 | 1958 | ||
| 7017 | 11년 전 | 2324 | ||
| 7016 | 11년 전 | 1031 | ||
| 7015 | 11년 전 | 2830 | ||
| 7014 | 11년 전 | 3032 | ||
| 7013 | 11년 전 | 1518 | ||
| 7012 |
|
11년 전 | 2197 | |
| 7011 | 11년 전 | 1049 | ||
| 7010 | 11년 전 | 1403 | ||
| 7009 |
|
11년 전 | 1079 | |
| 7008 | 11년 전 | 2271 | ||
| 7007 | 11년 전 | 2187 | ||
| 7006 |
|
11년 전 | 1180 | |
| 7005 | 11년 전 | 5311 | ||
| 7004 | 11년 전 | 2361 | ||
| 7003 | 11년 전 | 3074 | ||
| 7002 | 11년 전 | 1924 | ||
| 7001 | 11년 전 | 963 | ||
| 7000 | 11년 전 | 2050 | ||
| 6999 |
|
11년 전 | 2167 | |
| 6998 | 11년 전 | 1880 | ||
| 6997 |
네이비칼라
|
11년 전 | 1494 | |
| 6996 | 11년 전 | 955 | ||
| 6995 |
|
11년 전 | 1858 | |
| 6994 | 11년 전 | 2577 | ||
| 6993 |
kimsdesign
|
11년 전 | 1302 | |
| 6992 |
|
11년 전 | 2776 | |
| 6991 | 11년 전 | 1720 | ||
| 6990 | 11년 전 | 4474 | ||
| 6989 | 11년 전 | 1854 | ||
| 6988 |
네이비컬러
|
11년 전 | 2516 | |
| 6987 | 11년 전 | 3730 | ||
| 6986 |
잘살아보자
|
11년 전 | 1594 | |
| 6985 |
잘살아보자
|
11년 전 | 2477 | |
| 6984 | 11년 전 | 828 | ||
| 6983 |
천재조상훈
|
11년 전 | 1875 | |
| 6982 |
천재조상훈
|
11년 전 | 4502 | |
| 6981 |
천재조상훈
|
11년 전 | 1633 | |
| 6980 |
|
11년 전 | 1884 | |
| 6979 |
|
11년 전 | 758 | |
| 6978 |
잘살아보자
|
11년 전 | 1146 | |
| 6977 |
잘살아보자
|
11년 전 | 1471 | |
| 6976 |
잘살아보자
|
11년 전 | 1578 | |
| 6975 |
천재조상훈
|
11년 전 | 1481 | |
| 6974 |
잘살아보자
|
11년 전 | 2232 | |
| 6973 |
잘살아보자
|
11년 전 | 1159 | |
| 6972 |
잘살아보자
|
11년 전 | 3071 | |
| 6971 |
잘살아보자
|
11년 전 | 3279 | |
| 6970 |
잘살아보자
|
11년 전 | 1846 | |
| 6969 |
잘살아보자
|
11년 전 | 4776 | |
| 6968 | 11년 전 | 9905 | ||
| 6967 |
|
11년 전 | 2642 | |
| 6966 |
|
11년 전 | 1116 | |
| 6965 | 11년 전 | 3261 | ||
| 6964 | 11년 전 | 2584 | ||
| 6963 | 11년 전 | 2101 | ||
| 6962 |
star3840
|
11년 전 | 1018 | |
| 6961 | 11년 전 | 4245 | ||
| 6960 |
|
11년 전 | 729 | |
| 6959 | 11년 전 | 1255 | ||
| 6958 |
|
11년 전 | 1678 | |
| 6957 | 11년 전 | 1900 | ||
| 6956 |
잘살아보자
|
11년 전 | 1853 | |
| 6955 | 11년 전 | 4629 | ||
| 6954 | 11년 전 | 1628 | ||
| 6953 |
잘살아보자
|
11년 전 | 871 | |
| 6952 |
잘살아보자
|
11년 전 | 2049 | |
| 6951 | 11년 전 | 1613 | ||
| 6950 | 11년 전 | 2616 | ||
| 6949 |
잘살아보자
|
11년 전 | 888 | |
| 6948 | 11년 전 | 1560 | ||
| 6947 | 11년 전 | 1471 | ||
| 6946 | 11년 전 | 1615 | ||
| 6945 | 11년 전 | 1230 | ||
| 6944 | 11년 전 | 1193 | ||
| 6943 | 11년 전 | 1235 | ||
| 6942 | 11년 전 | 1588 | ||
| 6941 | 11년 전 | 1660 | ||
| 6940 | 11년 전 | 1756 | ||
| 6939 | 11년 전 | 1668 | ||
| 6938 | 11년 전 | 1948 | ||
| 6937 | 11년 전 | 1155 | ||
| 6936 | 11년 전 | 1352 | ||
| 6935 | 11년 전 | 1304 | ||
| 6934 | 11년 전 | 1472 | ||
| 6933 | 11년 전 | 1982 | ||
| 6932 | 11년 전 | 1536 | ||
| 6931 | 11년 전 | 1543 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기