Loading...
MySQL 9.5 Reference Manual 9.5의 14.9.4 Full-Text Stopwords의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
stopword 목록은 서버 문자 집합과 콜레이션(시스템 변수 character_set_server 및 collation_server의 값)을 사용하여 전체 텍스트 쿼리에 대해 로드되고 검색됩니다. stopword 파일이나 전체 텍스트 인덱싱 또는 검색에 사용되는 컬럼이 character_set_server 또는 collation_server와 다른 문자 집합 또는 콜레이션을 사용하는 경우 stopword 조회에서 false hit 또는 miss가 발생할 수 있습니다.
stopword 조회의 대소문자 구분 여부는 서버 콜레이션에 따라 달라집니다. 예를 들어, 콜레이션이 utf8mb4_0900_ai_ci인 경우 조회는 대소문자를 구분하지 않지만, 콜레이션이 utf8mb4_0900_as_cs 또는 utf8mb4_bin인 경우 조회는 대소문자를 구분합니다.
InnoDB에는 상대적으로 짧은 기본 stopword 목록이 있습니다. 이는 기술, 문학 및 기타 출처의 문서에서 짧은 단어를 키워드 또는 중요한 구문의 일부로 자주 사용하기 때문입니다.
예를 들어, “to be or not to be”를 검색했을 때 이러한 단어가 모두 무시되는 것이 아니라, 합리적인 결과를 얻기를 기대할 수 있습니다.
기본 InnoDB stopword 목록을 확인하려면 Information Schema의 INNODB_FT_DEFAULT_STOPWORD 테이블을 쿼리하십시오.
1mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; 2+-------+ 3| value | 4+-------+ 5| a | 6| about | 7| an | 8| are | 9| as | 10| at | 11| be | 12| by | 13| com | 14| de | 15| en | 16| for | 17| from | 18| how | 19| i | 20| in | 21| is | 22| it | 23| la | 24| of | 25| on | 26| or | 27| that | 28| the | 29| this | 30| to | 31| was | 32| what | 33| when | 34| where | 35| who | 36| will | 37| with | 38| und | 39| the | 40| www | 41+-------+ 4236 rows in set (0.00 sec)
모든 InnoDB 테이블에 대해 자체 stopword 목록을 정의하려면, INNODB_FT_DEFAULT_STOPWORD 테이블과 동일한 구조의 테이블을 정의하고, 그 테이블을 stopword로 채운 다음, 전체 텍스트 인덱스를 생성하기 전에 innodb_ft_server_stopword_table 옵션 값을 db_name/table_name 형식으로 설정합니다. stopword 테이블에는 value라는 이름의 단일 VARCHAR 컬럼이 있어야 합니다.
다음 예제는 InnoDB용 새로운 전역 stopword 테이블을 생성하고 설정하는 방법을 보여줍니다.
1-- Create a new stopword table 2 3mysql> CREATE TABLE my_stopwords(value VARCHAR(30)) ENGINE = INNODB; 4Query OK, 0 rows affected (0.01 sec) 5 6-- Insert stopwords (for simplicity, a single stopword is used in this example) 7 8mysql> INSERT INTO my_stopwords(value) VALUES ('Ishmael'); 9Query OK, 1 row affected (0.00 sec) 10 11-- Create the table 12 13mysql> CREATE TABLE opening_lines ( 14id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, 15opening_line TEXT(500), 16author VARCHAR(200), 17title VARCHAR(200) 18) ENGINE=InnoDb; 19Query OK, 0 rows affected (0.01 sec) 20 21-- Insert data into the table 22 23mysql> INSERT INTO opening_lines(opening_line,author,title) VALUES 24('Call me Ishmael.','Herman Melville','Moby-Dick'), 25('A screaming comes across the sky.','Thomas Pynchon','Gravity\'s Rainbow'), 26('I am an invisible man.','Ralph Ellison','Invisible Man'), 27('Where now? Who now? When now?','Samuel Beckett','The Unnamable'), 28('It was love at first sight.','Joseph Heller','Catch-22'), 29('All this happened, more or less.','Kurt Vonnegut','Slaughterhouse-Five'), 30('Mrs. Dalloway said she would buy the flowers herself.','Virginia Woolf','Mrs. Dalloway'), 31('It was a pleasure to burn.','Ray Bradbury','Fahrenheit 451'); 32Query OK, 8 rows affected (0.00 sec) 33Records: 8 Duplicates: 0 Warnings: 0 34 35-- Set the innodb_ft_server_stopword_table option to the new stopword table 36 37mysql> SET GLOBAL innodb_ft_server_stopword_table = 'test/my_stopwords'; 38Query OK, 0 rows affected (0.00 sec) 39 40-- Create the full-text index (which rebuilds the table if no FTS_DOC_ID column is defined) 41 42mysql> CREATE FULLTEXT INDEX idx ON opening_lines(opening_line); 43Query OK, 0 rows affected, 1 warning (1.17 sec) 44Records: 0 Duplicates: 0 Warnings: 1
Information Schema의 INNODB_FT_INDEX_TABLE 테이블을 쿼리하여 지정한 stopword('Ishmael')가 나타나지 않는지 확인합니다.
참고
기본적으로, 길이가 3 문자보다 짧거나 84 문자보다 긴 단어는 InnoDB 전체 텍스트 검색 인덱스에 나타지 않습니다. 최대 및 최소 단어 길이 값은 innodb_ft_max_token_size 및 innodb_ft_min_token_size 변수를 사용하여 설정할 수 있습니다.
이 기본 동작은 ngram 파서 플러그인에는 적용되지 않습니다. ngram 토큰 크기는 ngram_token_size 옵션으로 정의됩니다.
1mysql> SET GLOBAL innodb_ft_aux_table='test/opening_lines'; 2Query OK, 0 rows affected (0.00 sec) 3 4mysql> SELECT word FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE LIMIT 15; 5+-----------+ 6| word | 7+-----------+ 8| across | 9| all | 10| burn | 11| buy | 12| call | 13| comes | 14| dalloway | 15| first | 16| flowers | 17| happened | 18| herself | 19| invisible | 20| less | 21| love | 22| man | 23+-----------+ 2415 rows in set (0.00 sec)
테이블별로 stopword 목록을 생성하려면, 다른 stopword 테이블을 만들고 전체 텍스트 인덱스를 생성하기 전에 innodb_ft_user_stopword_table 옵션을 사용하여 사용하려는 stopword 테이블을 지정합니다.
stopword 파일은 character_set_server가 ucs2, utf16, utf16le 또는 utf32인 경우 latin1을 사용하여 로드되고 검색됩니다.
MyISAM 테이블에 대한 기본 stopword 목록을 재정의하려면 ft_stopword_file 시스템 변수를 설정합니다. ( Section 7.1.8, “Server System Variables” 참조.) 이 변수 값은 stopword 목록을 포함하는 파일의 경로 이름이거나, stopword 필터링을 비활성화하기 위한 빈 문자열이어야 합니다.
서버는 절대 경로 이름으로 다른 디렉토리를 지정하지 않는 한, 데이터 디렉토리에서 해당 파일을 찾습니다. 이 변수의 값이나 stopword 파일의 내용을 변경한 후에는 서버를 재시작하고 FULLTEXT 인덱스를 다시 빌드해야 합니다.
stopword 목록은 자유 형식이며, 줄바꿈, 공백, 쉼표와 같은 임의의 영숫자 이외의 문자로 stopword를 구분합니다. 예외적으로 밑줄 문자(_)와 단일 아포스트로피(')는 단어의 일부로 처리됩니다. stopword 목록의 문자 집합은 서버의 기본 문자 집합입니다. Section 12.3.2, “Server Character Set and Collation”을 참조하십시오.
다음 목록은 MyISAM 검색 인덱스에 대한 기본 stopword를 보여줍니다. MySQL 소스 배포본에서는 이 목록을 storage/myisam/ft_static.c 파일에서 찾을 수 있습니다.
1a's able about above according 2accordingly across actually after afterwards 3again against ain't all allow 4allows almost alone along already 5also although always am among 6amongst an and another any 7anybody anyhow anyone anything anyway 8anyways anywhere apart appear appreciate 9appropriate are aren't around as 10aside ask asking associated at 11available away awfully be became 12because become becomes becoming been 13before beforehand behind being believe 14below beside besides best better 15between beyond both brief but 16by c'mon c's came can 17can't cannot cant cause causes 18certain certainly changes clearly co 19com come comes concerning consequently 20consider considering contain containing contains 21corresponding could couldn't course currently 22definitely described despite did didn't 23different do does doesn't doing 24don't done down downwards during 25each edu eg eight either 26else elsewhere enough entirely especially 27et etc even ever every 28everybody everyone everything everywhere ex 29exactly example except far few 30fifth first five followed following 31follows for former formerly forth 32four from further furthermore get 33gets getting given gives go 34goes going gone got gotten 35greetings had hadn't happens hardly 36has hasn't have haven't having 37he he's hello help hence 38her here here's hereafter hereby 39herein hereupon hers herself hi 40him himself his hither hopefully 41how howbeit however i'd i'll 42i'm i've ie if ignored 43immediate in inasmuch inc indeed 44indicate indicated indicates inner insofar 45instead into inward is isn't 46it it'd it'll it's its 47itself just keep keeps kept 48know known knows last lately 49later latter latterly least less 50lest let let's like liked 51likely little look looking looks 52ltd mainly many may maybe 53me mean meanwhile merely might 54more moreover most mostly much 55must my myself name namely 56nd near nearly necessary need 57needs neither never nevertheless new 58next nine no nobody non 59none noone nor normally not 60nothing novel now nowhere obviously 61of off often oh ok 62okay old on once one 63ones only onto or other 64others otherwise ought our ours 65ourselves out outside over overall 66own particular particularly per perhaps 67placed please plus possible presumably 68probably provides que quite qv 69rather rd re really reasonably 70regarding regardless regards relatively respectively 71right said same saw say 72saying says second secondly see 73seeing seem seemed seeming seems 74seen self selves sensible sent 75serious seriously seven several shall 76she should shouldn't since six 77so some somebody somehow someone 78something sometime sometimes somewhat somewhere 79soon sorry specified specify specifying 80still sub such sup sure 81t's take taken tell tends 82th than thank thanks thanx 83that that's thats the their 84theirs them themselves then thence 85there there's thereafter thereby therefore 86therein theres thereupon these they 87they'd they'll they're they've think 88third this thorough thoroughly those 89though three through throughout thru 90thus to together too took 91toward towards tried tries truly 92try trying twice two un 93under unfortunately unless unlikely until 94unto up upon us use 95used useful uses using usually 96value various very via viz 97vs want wants was wasn't 98way we we'd we'll we're 99we've welcome well went were 100weren't what what's whatever when 101whence whenever where where's whereafter 102whereas whereby wherein whereupon wherever 103whether which while whither who 104who's whoever whole whom whose 105why will willing wish with 106within without won't wonder would 107wouldn't yes yet you you'd 108you'll you're you've your yours 109yourself yourselves zero
14.9.3 Full-Text Searches with Query Expansion
14.9.5 Full-Text Restrictions