GithubHelp home page GithubHelp logo

jaiminpan / pg_jieba Goto Github PK

View Code? Open in Web Editor NEW
325.0 325.0 63.0 4.14 MB

Postgresql full-text search extension for chinese

License: BSD 3-Clause "New" or "Revised" License

C++ 14.19% CMake 23.80% C 62.01%

pg_jieba's People

Contributors

erickguan avatar hank-cp avatar jaiminpan avatar jingmatrix avatar yanyiwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pg_jieba's Issues

cppjieba/Jieba.hpp: No such file or directory

[postgres@postgres build]$ make
Scanning dependencies of target pg_jieba
[100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:31:30: error: cppjieba/Jieba.hpp: No such file or directory
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:35: error: ‘cppjieba’ is not a namespace-name
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:35: error: expected namespace-name before ‘;’ token
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:213: error: ‘Word’ was not declared in this scope
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:213: error: template argument 1 is invalid
/home/postgres/soft/postgresql-9.6.6/contrib/pg_jieba/pg_jieba.cpp:213: error: template argument 2 is invalid

[postgres@localhost build]$ make
[100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o
/home/postgres/soft/postgresql-10.3/contrib/pg_jieba/pg_jieba.cpp:31:30: fatal error: cppjieba/Jieba.hpp: No such file or directory
#include "cppjieba/Jieba.hpp"
^
compilation terminated.
make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o] Error 1
make[1]: *** [CMakeFiles/pg_jieba.dir/all] Error 2
make: *** [all] Error 2

斷詞解析問題

使用預設 FTS Configurations 來調用斷詞解析:

SELECT * FROM ts_debug('jiebacfg', '我来到北京清华大学;他来到了网易杭研大厦;小明硕士毕业于**科学院计算所,后在日本京都大学深造')

結果:

alias | description | token | dictionaries | dictionary | lexemes
-------+-------------+--------------+--------------+------------+----------------
n | noun | 我 | {simple} | simple | {我}
n | noun | 来到 | {simple} | simple | {来到}
n | noun | 北京 | {simple} | simple | {北京}
n | noun | 清华大学 | {simple} | simple | {清华大学}
n | noun | ; | {simple} | simple | {;}
n | noun | 他 | {simple} | simple | {他}
n | noun | 来到 | {simple} | simple | {来到}
n | noun | 了 | {simple} | simple | {了}
n | noun | 网易 | {simple} | simple | {网易}
n | noun | 杭研 | {simple} | simple | {杭研}
n | noun | 大厦 | {simple} | simple | {大厦}
n | noun | ; | {simple} | simple | {;}
n | noun | 小明 | {simple} | simple | {小明}
n | noun | 硕士 | {simple} | simple | {硕士}
n | noun | 毕业 | {simple} | simple | {毕业}
n | noun | 于 | {simple} | simple | {于}
n | noun | **科学院 | {simple} | simple | {**科学院}
n | noun | 计算所 | {simple} | simple | {计算所}
n | noun | , | {simple} | simple | {,}
n | noun | 后 | {simple} | simple | {后}
n | noun | 在 | {simple} | simple | {在}
n | noun | 日本京都大学 | {simple} | simple | {日本京都大学}
n | noun | 深造 | {simple} | simple | {深造}
(23 rows)

=> 詞性皆歸類成 n

make 出错

make

[ 50%] Building C object CMakeFiles/pg_jieba.dir/pg_jieba.c.o
/usr/local/pg_jieba/pg_jieba.c:19:27: fatal error: utils/varlena.h: No such file or directory
#include "utils/varlena.h"
^
compilation terminated.
make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.c.o] Error 1
make[1]: *** [CMakeFiles/pg_jieba.dir/all] Error 2
make: *** [all] Error 2

postgre新手求问怎么使用pg_jieba

使用rel_v1.0.1分支,安装成功
执行select * from to_tsvector('jiebacfg', '小明硕士毕业于**科学院计算所,后在日本京都大学深造');能够正确返回.
现在我想再这个数据库新建一张表,并且某字段使用结巴分词来进行优化.那么该字段需要进行一些额外的声明或者设置吗.

centos7 + pg13, make: 未知的类型名‘sigjmp_buf’

cmake指定使用c99
cmake -DCMAKE_PREFIX_PATH=/usr/pgsql-13/ -DCMAKE_C_FLAGS="-std=c99"

make出错
[ 50%] Building C object CMakeFiles/pg_jieba.dir/pg_jieba.c.o In file included from /usr/pgsql-13/include/server/postgres.h:47:0, from /opt/download/pg_jieba/pg_jieba.c:14: /usr/pgsql-13/include/server/utils/elog.h:340:1: 错误:未知的类型名‘sigjmp_buf’ extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; ^ /opt/download/pg_jieba/pg_jieba.c:247:1: 警告:使用‘DefineCustomConfigVariables’时先前既没有原型也没有定义 [-Wmissing-prototypes] DefineCustomConfigVariables() ^ make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.c.o] 错误 1 make[1]: *** [CMakeFiles/pg_jieba.dir/all] 错误 2

pg 10.10 不支持

翻了一下日志报的是Segmentation fault;之前我有关注这个issue #42 ;
错误的提示差不多。
pg11我尝试了已经ok了。。但是pg10还是会报错。
请问下还有什么解决方法吗

Cannot compile pg_jieba on Ubuntu

I am having difficulties compiling pg_jieba.

git clone https://github.com/jaiminpan/pg_jieba
cd pg_jieba/
git submodule update --init --recursive
mkdir build
cd build

But then at cmake .. I get:

-- Setting pg_jieba build type - 
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found
  version "9.3.21")
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindPostgreSQL.cmake:151 (find_package_handle_standard_args)
  CMakeLists.txt:11 (find_package)

This is on Ubuntu 14.04.5, gcc 4.8.4, PostgreSQL 9.3.21, and pg_config is present and working. This seems to be the same error reported at #15, but it hasn't been closed yet, and I don't (yet) know enough Chinese to figure out why!

make error

centos7.0 gcc4.8.5 postgresql9.6.3 make error

[100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o
/root/0303/pg_jieba/pg_jieba.cpp: In constructor ‘pg_jieba::PgJieba::PgJieba(const string&, const string&, const string&)’:
/root/0303/pg_jieba/pg_jieba.cpp:204:10: error: ‘num_types’ does not name a type
auto num_types = sizeof(tok_alias) / sizeof(tok_alias[0]);
^
/root/0303/pg_jieba/pg_jieba.cpp:205:15: error: ‘i’ does not name a type
for (auto i = 1; i < num_types; ++i) {
^
/root/0303/pg_jieba/pg_jieba.cpp:205:22: error: expected ‘;’ before ‘i’
for (auto i = 1; i < num_types; ++i) {
^
/root/0303/pg_jieba/pg_jieba.cpp:205:22: error: ‘i’ was not declared in this scope
/root/0303/pg_jieba/pg_jieba.cpp:205:26: error: ‘num_types’ was not declared in this scope
for (auto i = 1; i < num_types; ++i) {
^
/root/0303/pg_jieba/pg_jieba.cpp:206:21: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
lex_id_.insert({tok_alias[i], i});
^
/root/0303/pg_jieba/pg_jieba.cpp:206:39: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
lex_id_.insert({tok_alias[i], i});
^
/root/0303/pg_jieba/pg_jieba.cpp:206:39: error: no matching function for call to ‘std::tr1::unordered_map<std::basic_string, int>::insert()’
/root/0303/pg_jieba/pg_jieba.cpp:206:39: note: candidates are:
In file included from /usr/include/c++/4.8.2/tr1/unordered_map:41:0,
from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:16,
from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/tr1/hashtable.h:374:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::_Insert_Return_Type std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::insert(const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::__detail::_Mod_range_hashing; _Hash = std::tr1::__detail::_Default_ranged_hash; _RehashPolicy = std::tr1::__detail::_Prime_rehash_policy; bool __cache_hash_code = false; bool __constant_iterators = false; bool __unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::_Insert_Return_Type = std::pair<std::tr1::__detail::_Hashtable_iterator<std::pair<const std::basic_string, int>, false, false>, bool>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::value_type = std::pair<const std::basic_string, int>]
insert(const value_type& __v)
^
/usr/include/c++/4.8.2/tr1/hashtable.h:374:7: note: no known conversion for argument 1 from ‘’ to ‘const value_type& {aka const std::pair<const std::basic_string, int>&}’
/usr/include/c++/4.8.2/tr1/hashtable.h:379:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::iterator std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::insert(std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::iterator, const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::__detail::_Mod_range_hashing; _Hash = std::tr1::__detail::_Default_ranged_hash; _RehashPolicy = std::tr1::__detail::_Prime_rehash_policy; bool __cache_hash_code = false; bool __constant_iterators = false; bool __unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::iterator = std::tr1::__detail::_Hashtable_iterator<std::pair<const std::basic_string, int>, false, false>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::value_type = std::pair<const std::basic_string, int>]
insert(iterator, const value_type& __v)
^
/usr/include/c++/4.8.2/tr1/hashtable.h:379:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8.2/tr1/hashtable.h:383:7: note: std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::const_iterator std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::insert(std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::const_iterator, const value_type&) [with _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::__detail::_Mod_range_hashing; _Hash = std::tr1::__detail::_Default_ranged_hash; _RehashPolicy = std::tr1::__detail::_Prime_rehash_policy; bool __cache_hash_code = false; bool __constant_iterators = false; bool __unique_keys = true; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::const_iterator = std::tr1::__detail::_Hashtable_const_iterator<std::pair<const std::basic_string, int>, false, false>; std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::value_type = std::pair<const std::basic_string, int>]
insert(const_iterator, const value_type& __v)
^
/usr/include/c++/4.8.2/tr1/hashtable.h:383:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8.2/tr1/hashtable.h:388:2: note: template void std::tr1::_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, __cache_hash_code, __constant_iterators, __unique_keys>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::basic_string; _Value = std::pair<const std::basic_string, int>; _Allocator = std::allocator<std::pair<const std::basic_string, int> >; _ExtractKey = std::_Select1st<std::pair<const std::basic_string, int> >; _Equal = std::equal_to<std::basic_string >; _H1 = std::tr1::hash<std::basic_string >; _H2 = std::tr1::__detail::_Mod_range_hashing; _Hash = std::tr1::__detail::_Default_ranged_hash; _RehashPolicy = std::tr1::__detail::_Prime_rehash_policy; bool __cache_hash_code = false; bool __constant_iterators = false; bool __unique_keys = true]
insert(_InputIterator __first, InputIterator last);
^
/usr/include/c++/4.8.2/tr1/hashtable.h:388:2: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:206:39: note: candidate expects 2 arguments, 1 provided
lex_id
.insert({tok_alias[i], i});
^
/root/0303/pg_jieba/pg_jieba.cpp: In member function ‘int pg_jieba::PgJieba::LookupLexTypeId(const string&) const’:
/root/0303/pg_jieba/pg_jieba.cpp:230:22: error: ‘const class std::tr1::unordered_map<std::basic_string, int>’ has no member named ‘at’
return lex_id
.at(this->LookupTag(str));
^
/root/0303/pg_jieba/pg_jieba.cpp:232:22: error: ‘const class std::tr1::unordered_map<std::basic_string, int>’ has no member named ‘at’
return lex_id
.at("n");
^
/root/0303/pg_jieba/pg_jieba.cpp: At global scope:
/root/0303/pg_jieba/pg_jieba.cpp:250:25: error: ‘nullptr’ was not declared in this scope
static PgJieba* jieba = nullptr;
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘void pg_jieba::_PG_init()’:
/root/0303/pg_jieba/pg_jieba.cpp:263:16: error: ‘nullptr’ was not declared in this scope
if (jieba != nullptr) {
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘void pg_jieba::_PG_fini()’:
/root/0303/pg_jieba/pg_jieba.cpp:280:16: error: ‘nullptr’ was not declared in this scope
if (jieba != nullptr) {
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_start(FunctionCallInfo)’:
/root/0303/pg_jieba/pg_jieba.cpp:293:8: error: ‘words’ does not name a type
auto words = new vector();
^
/root/0303/pg_jieba/pg_jieba.cpp:294:20: error: ‘words’ was not declared in this scope
jieba->Cut(str, words);
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_query_start(FunctionCallInfo)’:
/root/0303/pg_jieba/pg_jieba.cpp:306:8: error: ‘words’ does not name a type
auto words = new vector();
^
/root/0303/pg_jieba/pg_jieba.cpp:307:29: error: ‘words’ was not declared in this scope
jieba->CutForSearch(str, words);
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_gettoken(FunctionCallInfo)’:
/root/0303/pg_jieba/pg_jieba.cpp:322:9: error: ISO C++ forbids declaration of ‘cur_iter’ with no type [-fpermissive]
auto& cur_iter = ctx->iter;
^
/root/0303/pg_jieba/pg_jieba.cpp:322:25: error: invalid initialization of reference of type ‘int&’ from expression of type ‘std::vector<std::basic_string >::iterator {aka __gnu_cxx::__normal_iterator<std::basic_string
, std::vector<std::basic_string > >}’
auto& cur_iter = ctx->iter;
^
/root/0303/pg_jieba/pg_jieba.cpp:325:16: error: no match for ‘operator==’ (operand types are ‘int’ and ‘std::vector<std::basic_string >::iterator {aka __gnu_cxx::__normal_iterator<std::basic_string
, std::vector<std::basic_string > >}’)
if (cur_iter == ctx->words->end()) {
^
/root/0303/pg_jieba/pg_jieba.cpp:325:16: note: candidates are:
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:64:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/stl_pair.h:214:5: note: template<class _T1, class _T2> bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
/usr/include/c++/4.8.2/bits/stl_pair.h:214:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/stl_iterator.h:291:5: note: template bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
operator==(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:291:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/stl_iterator.h:341:5: note: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
operator==(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:341:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/char_traits.h:40:0,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/postypes.h:216:5: note: template bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
^
/usr/include/c++/4.8.2/bits/postypes.h:216:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::fpos<_StateT>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:41:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/allocator.h:128:5: note: template<class _T1, class _T2> bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_T2>&)
operator==(const allocator<_T1>&, const allocator<_T2>&)
^
/usr/include/c++/4.8.2/bits/allocator.h:128:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::allocator<_CharT>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:41:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/allocator.h:133:5: note: template bool std::operator==(const std::allocator<_CharT>&, const std::allocator<_CharT>&)
operator==(const allocator<_Tp>&, const allocator<_Tp>&)
^
/usr/include/c++/4.8.2/bits/allocator.h:133:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::allocator<_CharT>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:52:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/basic_string.h:2486:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^
/usr/include/c++/4.8.2/bits/basic_string.h:2486:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:52:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/basic_string.h:2493:5: note: template typename __gnu_cxx::__enable_if<std::__is_char<_Tp>::__value, bool>::__type std::operator==(const std::basic_string<_CharT>&, const std::basic_string<_CharT>&)
operator==(const basic_string<_CharT>& __lhs,
^
/usr/include/c++/4.8.2/bits/basic_string.h:2493:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:52:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/basic_string.h:2507:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
operator==(const _CharT* __lhs,
^
/usr/include/c++/4.8.2/bits/basic_string.h:2507:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const _CharT*’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/string:52:0,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/basic_string.h:2519:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^
/usr/include/c++/4.8.2/bits/basic_string.h:2519:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/vector:64:0,
from /root/0303/pg_jieba/pg_jieba.cpp:15:
/usr/include/c++/4.8.2/bits/stl_vector.h:1404:5: note: template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)
operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
^
/usr/include/c++/4.8.2/bits/stl_vector.h:1404:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::vector<_Tp, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/set:60:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_tree.h:310:5: note: template bool std::operator==(const std::_Rb_tree_iterator<_Tp>&, const std::_Rb_tree_const_iterator<_Val>&)
operator==(const _Rb_tree_iterator<_Val>& __x,
^
/usr/include/c++/4.8.2/bits/stl_tree.h:310:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Rb_tree_iterator<_Tp>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/set:60:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_tree.h:907:5: note: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator==(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)
operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_tree.h:907:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/set:61:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_set.h:754:5: note: template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&)
operator==(const set<_Key, _Compare, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_set.h:754:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::set<_Key, _Compare, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/set:62:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:5,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_multiset.h:739:5: note: template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&)
operator==(const multiset<_Key, _Compare, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_multiset.h:739:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::multiset<_Key, _Compare, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/locale_facets.h:48:0,
from /usr/include/c++/4.8.2/bits/basic_ios.h:37,
from /usr/include/c++/4.8.2/ios:44,
from /usr/include/c++/4.8.2/istream:38,
from /usr/include/c++/4.8.2/sstream:38,
from /root/0303/pg_jieba/libjieba/deps/limonp/Logging.hpp:4,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:7,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/streambuf_iterator.h:204:5: note: template<class _CharT, class _Traits> bool std::operator==(const std::istreambuf_iterator<_CharT, _Traits>&, const std::istreambuf_iterator<_CharT, _Traits>&)
operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
^
/usr/include/c++/4.8.2/bits/streambuf_iterator.h:204:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::istreambuf_iterator<_CharT, _Traits>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/map:61:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:6,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_map.h:962:5: note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&)
operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_map.h:962:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::map<_Key, _Tp, _Compare, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/map:62:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:6,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_multimap.h:864:5: note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator==(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&)
operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_multimap.h:864:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::multimap<_Key, _Tp, _Compare, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/iterator:66:0,
from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:22,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stream_iterator.h:130:5: note: template<class _Tp, class _CharT, class _Traits, class _Dist> bool std::operator==(const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&, const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&)
operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
^
/usr/include/c++/4.8.2/bits/stream_iterator.h:130:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>’ and .int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/deque:64:0,
from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28,
from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_deque.h:247:5: note: template<class _Tp, class _Ref, class _Ptr> bool std::operator==(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)
operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
^
/usr/include/c++/4.8.2/bits/stl_deque.h:247:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Deque_iterator<_Tp, _Ref, _Ptr>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/deque:64:0,
from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28,
from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_deque.h:254:5: note: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> bool std::operator==(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&)
operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
^
/usr/include/c++/4.8.2/bits/stl_deque.h:254:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::_Deque_iterator<_Tp, _Ref, _Ptr>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/deque:64:0,
from /root/0303/pg_jieba/libjieba/deps/limonp/StdExtension.hpp:28,
from /root/0303/pg_jieba/libjieba/deps/limonp/StringUtil.hpp:24,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:13,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_deque.h:1957:5: note: template<class _Tp, class _Alloc> bool std::operator==(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)
operator==(const deque<_Tp, _Alloc>& __x,
^
/usr/include/c++/4.8.2/bits/stl_deque.h:1957:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::deque<_Tp, _Alloc>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/queue:64:0,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Trie.hpp:5,
from /root/0303/pg_jieba/libjieba/include/cppjieba/DictTrie.hpp:16,
from /root/0303/pg_jieba/libjieba/include/cppjieba/QuerySegment.hpp:8,
from /root/0303/pg_jieba/libjieba/include/cppjieba/Jieba.hpp:4,
from /root/0303/pg_jieba/pg_jieba.cpp:31:
/usr/include/c++/4.8.2/bits/stl_queue.h:268:5: note: template<class _Tp, class _Seq> bool std::operator==(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&)
operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
^
/usr/include/c++/4.8.2/bits/stl_queue.h:268:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const std::queue<_Tp, _Seq>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++allocator.h:33:0,
from /usr/include/c++/4.8.2/bits/allocator.h:46,
from /usr/include/c++/4.8.2/string:41,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/ext/new_allocator.h:139:5: note: template bool __gnu_cxx::operator==(const __gnu_cxx::new_allocator<_Tp>&, const __gnu_cxx::new_allocator<_Tp>&)
operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
^
/usr/include/c++/4.8.2/ext/new_allocator.h:139:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const __gnu_cxx::new_allocator<_Tp>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/stl_iterator.h:811:5: note: template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:811:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const __gnu_cxx::__normal_iterator<_Iterator, _Container>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /root/0303/pg_jieba/pg_jieba.cpp:14:
/usr/include/c++/4.8.2/bits/stl_iterator.h:805:5: note: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:805:5: note: template argument deduction/substitution failed:
/root/0303/pg_jieba/pg_jieba.cpp:325:35: note: mismatched types ‘const __gnu_cxx::__normal_iterator<_IteratorL, _Container>’ and ‘int’
if (cur_iter == ctx->words->end()) {
^
/root/0303/pg_jieba/pg_jieba.cpp:332:34: error: invalid type argument of unary ‘*’ (have ‘int’)
type = jieba->LookupLexTypeId(*cur_iter);
^
/root/0303/pg_jieba/pg_jieba.cpp:333:36: error: base operand of ‘->’ is not a pointer
*tlen = static_cast(cur_iter->length());
^
/root/0303/pg_jieba/pg_jieba.cpp:334:34: error: base operand of ‘->’ is not a pointer
t = const_cast<char>(cur_iter->c_str());
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_end(FunctionCallInfo)’:
/root/0303/pg_jieba/pg_jieba.cpp:343:21: error: ‘nullptr’ was not declared in this scope
if (ctx->words != nullptr) {
^
/root/0303/pg_jieba/pg_jieba.cpp: In function ‘Datum pg_jieba::jieba_lextype(FunctionCallInfo)’:
/root/0303/pg_jieba/pg_jieba.cpp:353:8: error: ‘size’ does not name a type
auto size = jieba->GetLexTypeSize();
^
/root/0303/pg_jieba/pg_jieba.cpp:354:70: error: ‘size’ was not declared in this scope
LexDescr descr = static_cast<LexDescr>(palloc(sizeof(LexDescr) * size));
^
make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o] Error 1
make[1]: *** [CMakeFiles/pg_jieba.dir/all] Error 2
make: *** [all] Error 2

看了其他的issue,尝试用v1.0.1版本,还是同样的环境,USE_PGXS=1 make错误
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -fpic -shared -o pg_jieba.so pg_jieba.o jieba.o -L/usr/pgsql-9.6/lib -Wl,--as-needed -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-9.6/lib',--enable-new-dtags -lstdc++
/bin/ld: jieba.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
jieba.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [pg_jieba.so] Error 1

make install failed.

make ok

USE_PGXS=1 make
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -W
all -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fpic -I. -I/usr/include/pgsq
l/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c -o pg_jieba.o pg_jieba.c
g++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -W
all -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fpic -I. -I/usr/include/pgsq
l/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2  -DLOGGER_LEVEL=LL_WARN -o jieba.o -c libjieba/jieba.cpp
cc1plus: warning: command line option "-Wmissing-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -W
all -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fpic -shared  pg_jieba.o jie
ba.o   -L/usr/lib64 -lstdc++ -o pg_jieba.so

make install failed;

sudo make install
Makefile:22: ../../src/Makefile.global: No such file or directory
Makefile:23: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'.  Stop.

在Ubuntu 16.04.2 LTS postgreSQL 10 是make 异常

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

Ubuntu 16.04.2 LTS
Linux ubuntu 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

postgreSQL 10

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

ucmed@ubuntu:/opt/postgresql-10.0/pg_jieba$ make
[ 50%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o

**In file included from /opt/pgsql/10/include/server/postgres.h:47:0,

             from /opt/postgresql-10.0/pg_jieba/pg_jieba.cpp:21:

/usr/include/libintl.h:39:14: error: expected unqualified-id before ‘const’**
extern char *gettext (const char *__msgid)
^
/usr/include/libintl.h:39:14: error: expected ‘)’ before ‘const’
/usr/include/libintl.h:39:14: error: expected initializer before ‘const’
/usr/include/libintl.h:44:14: error: expected unqualified-id before ‘const’
extern char *dgettext (const char *__domainname, const char *__msgid)
^
/usr/include/libintl.h:44:14: error: expected ‘)’ before ‘const’
/usr/include/libintl.h:44:14: error: expected initializer before ‘const’
/usr/include/libintl.h:61:14: error: expected unqualified-id before ‘unsigned’
extern char *ngettext (const char *__msgid1, const char *__msgid2,
^
/usr/include/libintl.h:61:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:61:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:61:14: error: expected initializer before ‘unsigned’
/usr/include/libintl.h:67:14: error: expected unqualified-id before ‘unsigned’
extern char *dngettext (const char *__domainname, const char *__msgid1,
^
/usr/include/libintl.h:67:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:67:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:67:14: error: expected initializer before ‘unsigned’
CMakeFiles/pg_jieba.dir/build.make:62: recipe for target 'CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o' failed
make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pg_jieba.dir/all' failed
make[1]: *** [CMakeFiles/pg_jieba.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

libjieba/jieba/limonp/StdExtension.hpp:7:10: fatal error: 'unordered_map' file not found

user@test ~/Downloads/pg_jieba
master* $ USE_PGXS=1 make                                                                                                                                                                                                                                                                                          [14:15:39]
c++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -mmacosx-version-min=10.7 -I. -I./ -I/Applications/Postgres.app/Contents/Versions/9.5/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.5/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.5/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.5/include -DLOGGER_LEVEL=LL_WARN -o jieba.o -c libjieba/jieba.cpp
In file included from libjieba/jieba.cpp:15:
In file included from libjieba/jieba/MixSegment.hpp:5:
In file included from libjieba/jieba/MPSegment.hpp:8:
In file included from libjieba/jieba/DictTrie.hpp:11:
In file included from libjieba/jieba/limonp/StringUtil.hpp:24:
libjieba/jieba/limonp/StdExtension.hpp:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
1 error generated.
make: *** [jieba.o] Error 1

my os is OS X el capitan

CMake Error

环境:Ubuntu16.04, Postgresql9.6.5
执行cmake .. 的时候报如下错误:
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found
version "9.6.5")
有什么办法可以解决吗?谢谢您!

Postgresql 13下版本号问题

我通过下面命令在13下编译通过了

cmake DPostgreSQL_INCLUDE_DIRS=/usr/include/postgresql/13/server ..

但进入数据执行 create extension pg_jieba;

报版本错误

ERROR: incompatible library "/usr/lib/postgresql/13/lib/pg_jieba.so": version mismatch DETAIL: Server is version 13, library is version 10.

pg_dump备份数据备份不了pg_jieba

创建数据库,安装pg_jieba扩展后,
执行:

pg_dump -U postgres -h 127.0.0.1 -d postgres > postgres.bak

执行失败:

pg_dump: [archiver (db)] query failed: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
pg_dump: [archiver (db)] query was: SELECT
  ( SELECT alias FROM pg_catalog.ts_token_type('32776'::pg_catalog.oid) AS t
    WHERE t.tokid = m.maptokentype ) AS tokenname,
  m.mapdict::pg_catalog.regdictionary AS dictname
FROM pg_catalog.pg_ts_config_map AS m
WHERE m.mapcfg = '32780'
ORDER BY m.mapcfg, m.maptokentype, m.mapseqno

把这句sql放在数据库中执行,有时会退出进程

postgres=#  SELECT
  ( SELECT alias FROM pg_catalog.ts_token_type('32776'::pg_catalog.oid) AS t
    WHERE t.tokid = m.maptokentype ) AS tokenname,
  m.mapdict::pg_catalog.regdictionary AS dictname
FROM pg_catalog.pg_ts_config_map AS m
WHERE m.mapcfg = '32780'
ORDER BY m.mapcfg, m.maptokentype, m.mapseqno;
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> 
!> 
!> 

有时会得到如下结果:

postgres=#  SELECT
  ( SELECT alias FROM pg_catalog.ts_token_type('32776'::pg_catalog.oid) AS t
    WHERE t.tokid = m.maptokentype ) AS tokenname,
  m.mapdict::pg_catalog.regdictionary AS dictname
FROM pg_catalog.pg_ts_config_map AS m
WHERE m.mapcfg = '32780'
ORDER BY m.mapcfg, m.maptokentype, m.mapseqno;

 tokenname |  dictname  
-----------+------------
 nz        | jieba_syn
 nz        | jieba_stem
 n         | jieba_syn
 n         | jieba_stem
 m         | jieba_syn
 m         | jieba_stem
 i         | jieba_syn
 i         | jieba_stem
 l         | jieba_syn
 l         | jieba_stem
 d         | jieba_syn
 d         | jieba_stem
 s         | jieba_syn
 s         | jieba_stem
 t         | jieba_syn
 t         | jieba_stem
 mq        | jieba_syn
 mq        | jieba_stem
 nr        | jieba_syn
 nr        | jieba_stem
 j         | jieba_syn
 j         | jieba_stem
 a         | jieba_syn
 a         | jieba_stem
 r         | jieba_syn
 r         | jieba_stem
 b         | jieba_syn
 b         | jieba_stem
 f         | jieba_syn
 f         | jieba_stem
 nrt       | jieba_syn
 nrt       | jieba_stem
 v         | jieba_syn
 v         | jieba_stem
 z         | jieba_syn
 z         | jieba_stem
 ns        | jieba_syn
 ns        | jieba_stem
 q         | jieba_syn
 q         | jieba_stem
 vn        | jieba_syn
 vn        | jieba_stem
...

请问您知道这是什么原因吗?

pg_jieba gives unexpected results

I have installed pg_jieba on Ubuntu 16.04, PostgreSQL 9.5.11, GCC 5.4.0, cmake 3.5.1. However, it does not give the expected results.

qiezi=# select to_tsvector('jiebacfg', '一个普通随和一点的人。');
-[ RECORD 1 ]------------------------------------
to_tsvector | '一个':1 '一点':4 '普通':2 '随和':3

The output is missing the final characters 的人。 On the webapp, entering the same sentence gives:

["一个", "普通", "随和", "一点", "的人", "。"]

where those characters are included.

Using the sample query on the front page:

qiezi=# select * from to_tsvector('jiebacfg', '小明硕士毕业于**科学院计算所, 后在日本京都大学深造');
-[ RECORD 1 ]---------------------------------------------------------------------------------
to_tsvector | '**科学院':5 '小明':1 '日本京都大学':10 '毕业':3 '深造':11 '硕士':2 '计算所':6

the words at 4, 7, 8, and 9 are missing compared with what the frontpage says should be the output:

**科学院':5 '于':4 '后':8 '在':9 '小明':1 '日本京都大学':10 '毕业':3 '深造':11 '硕士':2 '计算所':6 ',':7

and the webapp also includes all the characters:

["小明", "硕士", "毕业", "于", "**科学院", "计算所", ",", " ", "后", "在", "日本京都大学", "深造"]

Is there some setting that needs to be adjusted so that the installed version of pg_jieba works as expected?

Freebsd 12 + PostgreSQL 12, 编译后无法使用

编译时出现提醒

/root/src/pg/pg_jieba/pg_jieba.c:247:1: warning: 'DefineCustomConfigVariables' was used with no prototype before its definition [-Wmissing-prototypes]
  247 | DefineCustomConfigVariables()
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: warning: unrecognized command line option '-Wno-unused-command-line-argument'

可以编译成功并安装

在执行create extension pg_jieba;时, 提醒无法加载库, Undefined symbol "__cxa_pure_virtual"

postgres14 分词和预期结果不一致

首页文档中示例
select * from to_tsquery('jiebacfg', '是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。');
应该返回
'拖拉机' & '学院' & '手扶拖拉机' & '专业' & '不用' & '多久' & '会' & '升职' & '加薪' & '当上' & 'ceo' & '走上' & '人生' & '巅峰'
实际返回
'拖拉机' <-> '学院' <-> '手扶拖拉机' <-> '专业' <3> '不用' <-> '多久' <4> '会' <-> '升职' <-> '加薪' <2> '当上' <-> 'ceo' <2> '走上' <-> '人生' <-> '巅峰'

CentOS 7.4 和 PostgreSQL 10.0 下编译错误

export PATH=/usr/pgsql-10/bin:$PATH
cd pg_jieba
mkdir build
cd build
cmake ..

-- Setting pg_jieba build type -
CMake Warning at /usr/share/cmake/Modules/FindPostgreSQL.cmake:109 (message):
Couldn't determine PostgreSQL configuration.
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPostgreSQL.cmake:145 (fail_if)
CMakeLists.txt:11 (find_package)

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY_DIRS
PostgreSQL_INCLUDE_DIRS PostgreSQL_LIBRARIES) (found version "10.0")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindPostgreSQL.cmake:173 (find_package_handle_standard_args)
CMakeLists.txt:11 (find_package)

-- Configuring incomplete, errors occurred!
See also "/root/pg_jieba/build/CMakeFiles/CMakeOutput.log".

CentOS 7 + PostgreSQL 12,cmake失败

OS: CentOS Linux release 7.8.2003 (Core)
PostgreSQL版本:12.3 (yum 安装)
gcc版本: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
postgresql12-devel: 已安装

备注:在Ubuntu 20.04 + PostgreSQL 12的环境下安装pg_jieba没问题。

出错的命令

cmake -DPostgreSQL_LIBRARY_DIRS=/usr/pgsql12/lib -DPostgreSQL_INCLUDE_DIRS=/usr/pgsql12/include -DCMAKE_CXX_FLAGS="-Wall -std=c++11" ..

控制台信息

-- Setting pg_jieba build type -
CMake Warning at /usr/share/cmake/Modules/FindPostgreSQL.cmake:109 (message):
  Couldn't determine PostgreSQL configuration.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPostgreSQL.cmake:145 (faile_if)
  CMakeLists.txt:11 (find_package)

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARIES) (found version "12.3")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindPostgreSQL.cmake:173 (find_package_handle_standard_args)
  CMakeLists.txt:11 (find_package)

-- Configuration incomplete, errors occurred!

CMakeOutput.log:

The system is: Linux - 3.10.0-957.21.3.el7.x86_64 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/cc 
Build flags: 
Id flags: 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/canvas/Downloads/pg_jieba/build/CMakeFiles/2.8.12.2/CompilerIdC/a.out"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/c++ 
Build flags: -Wall;-std=c++11
Id flags: 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is GNU, found in "/home/canvas/Downloads/pg_jieba/build/CMakeFiles/2.8.12.2/CompilerIdCXX/a.out"

Determining if the C compiler works passed with the following output:
Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec273395842/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec273395842.dir/build.make CMakeFiles/cmTryCompileExec273395842.dir/build
gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec273395842.dir/testCCompiler.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec273395842.dir/testCCompiler.c.o   -c /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTryCompileExec273395842
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec273395842.dir/link.txt --verbose=1
/usr/bin/cc       CMakeFiles/cmTryCompileExec273395842.dir/testCCompiler.c.o  -o cmTryCompileExec273395842 -rdynamic 
gmake[1]: Leaving directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'


Detecting C compiler ABI info compiled with the following output:
Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec1052136036/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1052136036.dir/build.make CMakeFiles/cmTryCompileExec1052136036.dir/build
gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o   -c /usr/share/cmake/Modules/CMakeCCompilerABI.c
Linking C executable cmTryCompileExec1052136036
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1052136036.dir/link.txt --verbose=1
/usr/bin/cc     -v CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o  -o cmTryCompileExec1052136036 -rdynamic  
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec1052136036' '-rdynamic' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1052136036 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o
gmake[1]: Leaving directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'


Parsed C implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command:/usr/bin/gmake "cmTryCompileExec1052136036/fast"]
  ignore line: [/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1052136036.dir/build.make CMakeFiles/cmTryCompileExec1052136036.dir/build]
  ignore line: [gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp']
  ignore line: [/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1]
  ignore line: [Building C object CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o]
  ignore line: [/usr/bin/cc    -o CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o   -c /usr/share/cmake/Modules/CMakeCCompilerABI.c]
  ignore line: [Linking C executable cmTryCompileExec1052136036]
  ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1052136036.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/cc     -v CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o  -o cmTryCompileExec1052136036 -rdynamic  ]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/cc]
  ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper]
  ignore line: [Target: x86_64-redhat-linux]
  ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
  ignore line: [Thread model: posix]
  ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ]
  ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec1052136036' '-rdynamic' '-mtune=generic' '-march=x86-64']
  link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1052136036 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o]
    arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore
    arg [--build-id] ==> ignore
    arg [--no-add-needed] ==> ignore
    arg [--eh-frame-hdr] ==> ignore
    arg [--hash-style=gnu] ==> ignore
    arg [-m] ==> ignore
    arg [elf_x86_64] ==> ignore
    arg [-export-dynamic] ==> ignore
    arg [-dynamic-linker] ==> ignore
    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
    arg [-o] ==> ignore
    arg [cmTryCompileExec1052136036] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64]
    arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
    arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..]
    arg [CMakeFiles/cmTryCompileExec1052136036.dir/CMakeCCompilerABI.c.o] ==> ignore
    arg [-lgcc] ==> lib [gcc]
    arg [--as-needed] ==> ignore
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [--no-as-needed] ==> ignore
    arg [-lc] ==> lib [c]
    arg [-lgcc] ==> lib [gcc]
    arg [--as-needed] ==> ignore
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [--no-as-needed] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore
  remove lib [gcc]
  remove lib [gcc_s]
  remove lib [gcc]
  remove lib [gcc_s]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64]
  collapse library dir [/lib/../lib64] ==> [/lib64]
  collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib]
  implicit libs: [c]
  implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib]
  implicit fwks: []


Determining if the CXX compiler works passed with the following output:
Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec3375887650/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec3375887650.dir/build.make CMakeFiles/cmTryCompileExec3375887650.dir/build
gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec3375887650.dir/testCXXCompiler.cxx.o
/usr/bin/c++    -Wall -std=c++11    -o CMakeFiles/cmTryCompileExec3375887650.dir/testCXXCompiler.cxx.o -c /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTryCompileExec3375887650
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3375887650.dir/link.txt --verbose=1
/usr/bin/c++   -Wall -std=c++11     CMakeFiles/cmTryCompileExec3375887650.dir/testCXXCompiler.cxx.o  -o cmTryCompileExec3375887650 -rdynamic 
gmake[1]: Leaving directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'


Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec1231773451/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1231773451.dir/build.make CMakeFiles/cmTryCompileExec1231773451.dir/build
gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o
/usr/bin/c++    -Wall -std=c++11    -o CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTryCompileExec1231773451
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1231773451.dir/link.txt --verbose=1
/usr/bin/c++   -Wall -std=c++11   -v CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o  -o cmTryCompileExec1231773451 -rdynamic  
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-Wall' '-std=c++11' '-v' '-o' 'cmTryCompileExec1231773451' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1231773451 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o
gmake[1]: Leaving directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp'


Parsed CXX implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command:/usr/bin/gmake "cmTryCompileExec1231773451/fast"]
  ignore line: [/usr/bin/gmake -f CMakeFiles/cmTryCompileExec1231773451.dir/build.make CMakeFiles/cmTryCompileExec1231773451.dir/build]
  ignore line: [gmake[1]: Entering directory `/home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp']
  ignore line: [/usr/bin/cmake -E cmake_progress_report /home/canvas/Downloads/pg_jieba/build/CMakeFiles/CMakeTmp/CMakeFiles 1]
  ignore line: [Building CXX object CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o]
  ignore line: [/usr/bin/c++    -Wall -std=c++11    -o CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp]
  ignore line: [Linking CXX executable cmTryCompileExec1231773451]
  ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1231773451.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/c++   -Wall -std=c++11   -v CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o  -o cmTryCompileExec1231773451 -rdynamic  ]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/c++]
  ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper]
  ignore line: [Target: x86_64-redhat-linux]
  ignore line: [Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux]
  ignore line: [Thread model: posix]
  ignore line: [gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ]
  ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-Wall' '-std=c++11' '-v' '-o' 'cmTryCompileExec1231773451' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
  link line: [ /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1231773451 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o]
    arg [/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2] ==> ignore
    arg [--build-id] ==> ignore
    arg [--no-add-needed] ==> ignore
    arg [--eh-frame-hdr] ==> ignore
    arg [--hash-style=gnu] ==> ignore
    arg [-m] ==> ignore
    arg [elf_x86_64] ==> ignore
    arg [-export-dynamic] ==> ignore
    arg [-dynamic-linker] ==> ignore
    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
    arg [-o] ==> ignore
    arg [cmTryCompileExec1231773451] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o] ==> ignore
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64]
    arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
    arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..]
    arg [CMakeFiles/cmTryCompileExec1231773451.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
    arg [-lstdc++] ==> lib [stdc++]
    arg [-lm] ==> lib [m]
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [-lgcc] ==> lib [gcc]
    arg [-lc] ==> lib [c]
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [-lgcc] ==> lib [gcc]
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o] ==> ignore
  remove lib [gcc_s]
  remove lib [gcc]
  remove lib [gcc_s]
  remove lib [gcc]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5] ==> [/usr/lib/gcc/x86_64-redhat-linux/4.8.5]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64] ==> [/usr/lib64]
  collapse library dir [/lib/../lib64] ==> [/lib64]
  collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../..] ==> [/usr/lib]
  implicit libs: [stdc++;m;c]
  implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/4.8.5;/usr/lib64;/lib64;/usr/lib]
  implicit fwks: []

to_tsquery有没有办法精确搜索?

select (to_tsquery('jiebacfg', '新能源汽车'));
    to_tsquery
-------------------
 '新能源' & '汽车'

会检索'新能源'和'汽车'两个词
可能搜索到以大量'汽车'为内容、仅提及到个别'新能源'词的文档, 这样的结果是不太准确的

有没有一种模式可以实现精确搜索:
以jiebacfg创建tsvector索引,但在检索的时候不分词,仅以空格切割,类似simple的效果

如:

  1. ‘新能源汽车’-->检索'新能源汽车';
  2. '新能源 汽车'-->检索'新能源' & '汽车'

Space character (" ") on stop-word list acts like a separator instead of a character

The space character (" ") is already on the default stop-word list.
But SELECT ts_lexize('jieba_stem', ' '); => {" "} instead of {}

Even more, when adding apple watch to the list. Here are the results of ts_lexize:
apple watch => {"apple watch"}, apple => {}, watch => {watch}

Seems that the space character breaks the line into the first lexis only.

ubuntu 16.04 下 make 错误

jun@jun-Aspire-K4000:~/pg_jb/pg_jieba/build$ sudo make
-- Setting pg_jieba build type -
-- POSTGRESQL_EXECUTABLE is /usr/lib/postgresql/9.5/bin/postgres
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jun/pg_jb/pg_jieba/build
Scanning dependencies of target pg_jieba
[ 50%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o
/home/jun/pg_jb/pg_jieba/pg_jieba.cpp:31:30: fatal error: cppjieba/Jieba.hpp: 没有那个文件或目录
compilation terminated.
CMakeFiles/pg_jieba.dir/build.make:62: recipe for target 'CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o' failed
make[2]: *** [CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pg_jieba.dir/all' failed
make[1]: *** [CMakeFiles/pg_jieba.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

分词粒度设置

请问如何设置分词粒度为FullSegment,pg_jieba.sql里面只有两个parser,而且实现是一样的:

CREATE TEXT SEARCH PARSER jieba (
	START    = jieba_start,
	GETTOKEN = jieba_gettoken,
	END      = jieba_end,
	LEXTYPES = jieba_lextype,
	HEADLINE = pg_catalog.prsd_headline
);

CREATE TEXT SEARCH PARSER jiebaqry (
	START    = jieba_query_start,
	GETTOKEN = jieba_gettoken,
	END      = jieba_end,
	LEXTYPES = jieba_lextype,
	HEADLINE = pg_catalog.prsd_headline
);

高亮丢词

> select ts_headline('jiebacfg', '高清下载', to_tsquery('jiebacfg', '高清下载'));
 ts_headline 
-------------
 <b>高清</b>
(1 row)

“下载”不见了。

make error unimplemented: -fexcess-precision=standard for C++

root@digoal-> make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -DLOCK_DEBUG -DBTREE_BUILD_STATS -DWAL_DEBUG -DOPTIMIZER_DEBUG -DGEQO_DEBUG -DCOPY_PARSE_PLAN_TREES -DTRACE_SYNCSCAN -fpic -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include/libxml2   -c -o pg_jieba.o pg_jieba.c
g++ -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -DLOCK_DEBUG -DBTREE_BUILD_STATS -DWAL_DEBUG -DOPTIMIZER_DEBUG -DGEQO_DEBUG -DCOPY_PARSE_PLAN_TREES -DTRACE_SYNCSCAN -fpic -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include/libxml2  -DLOGGER_LEVEL=LL_WARN -o jieba.o -c libjieba/jieba.cpp
cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++
cc1plus: sorry, unimplemented: -fexcess-precision=standard for C++
make: *** [jieba.o] Error 1

同义词问题

如何实现同义词替换问题

例如: 每一个同义词列为一行,每行第一个词为希望分隔后呈现的词语
星海街 星海路
苏州工业园区 苏州园区 苏州工业园

64位ubuntu18下postgres10不能创建pg_jieba

在ubuntu下编译完成了,make install也没有问题
但是在postgres中测试的时候出现如下错误信息:

colern=# create extension pg_jieba;
FATAL:  cannot create PGC_POSTMASTER variables after startup
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.

请问该如何解决?

Compile error during make

centos: release-6-7
gcc: 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)

  1. Followed the steps by readme.md.
  2. cmake .. -DCMAKE_PREFIX_PATH=/usr/local/pgsql .... passed.
  3. make
[100%] Building CXX object CMakeFiles/pg_jieba.dir/pg_jieba.cpp.o
In file included from /usr/local/pgsql/include/server/postgres.h:47:0,
                 from /opt/pg_jieba/pg_jieba.cpp:21:
/usr/include/libintl.h:40:14: error: expected unqualified-id before ‘__const’
 extern char *gettext (__const char *__msgid)
              ^
/usr/include/libintl.h:40:14: error: expected ‘)’ before ‘__const’
/usr/include/libintl.h:40:14: error: expected initializer before ‘__const’
/usr/include/libintl.h:45:14: error: expected unqualified-id before ‘__const’
 extern char *dgettext (__const char *__domainname, __const char *__msgid)
              ^
/usr/include/libintl.h:45:14: error: expected ‘)’ before ‘__const’
/usr/include/libintl.h:45:14: error: expected initializer before ‘__const’
/usr/include/libintl.h:62:14: error: expected unqualified-id before ‘unsigned’
 extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
              ^
/usr/include/libintl.h:62:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:62:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:62:14: error: expected initializer before ‘unsigned’
/usr/include/libintl.h:68:14: error: expected unqualified-id before ‘unsigned’
 extern char *dngettext (__const char *__domainname, __const char *__msgid1,
              ^
/usr/include/libintl.h:68:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:68:14: error: expected ‘)’ before ‘unsigned’
/usr/include/libintl.h:68:14: error: expected initializer before ‘unsigned’
/opt/pg_jieba/pg_jieba.cpp: In constructor ‘pg_jieba::PgJieba::PgJieba(const string&, const string&, const string&)’:
/opt/pg_jieba/pg_jieba.cpp:204:10: error: ‘num_types’ does not name a type
     auto num_types = sizeof(tok_alias) / sizeof(tok_alias[0]);
          ^
/opt/pg_jieba/pg_jieba.cpp:205:15: error: ‘i’ does not name a type
     for (auto i = 1; i < num_types; ++i) {
               ^
/opt/pg_jieba/pg_jieba.cpp:205:22: error: expected ‘;’ before ‘i’
     for (auto i = 1; i < num_types; ++i) {
                      ^
/opt/pg_jieba/pg_jieba.cpp:205:22: error: ‘i’ was not declared in this scope
/opt/pg_jieba/pg_jieba.cpp:205:26: error: ‘num_types’ was not declared in this scope
     for (auto i = 1; i < num_types; ++i) {
                          ^
...

Hope to resolve, thanks.

使用时发现一个错误

错误: 库 "/usr/lib/postgresql/9.6/lib/pg_jieba.so"不兼容:版本不匹配
描述: 服务器版本是9.6,库的版本是9.5.

FTS Configurations 顯示問題.

預設 FTS Configurations 顯示為:

CREATE TEXT SEARCH CONFIGURATION jiebacfg (
PARSER = jieba
);
ALTER TEXT SEARCH CONFIGURATION jiebacfg ADD MAPPING FOR a WITH simple;
ALTER TEXT SEARCH CONFIGURATION jiebacfg ADD MAPPING FOR d WITH simple;
ALTER TEXT SEARCH CONFIGURATION jiebacfg ADD MAPPING FOR n WITH simple;
COMMENT ON TEXT SEARCH CONFIGURATION jiebacfg IS 'configuration for jieba';

=> v 沒有呈現出來

執行:

ALTER TEXT SEARCH CONFIGURATION jiebacfg ADD MAPPING FOR v WITH simple;

結果:

ERROR: duplicate key value violates unique constraint "pg_ts_config_map_index"
DETAIL: Key (mapcfg, maptokentype, mapseqno)=(377086, 3, 1) already exists.

=> v 確實有存在

環境:
PostgreSQL: 9.4.5

server closed the connection unexpectedly when test on windows 64

I compile it for windows with vs2015.
create extension successful but when i run
select to_tsvector('jiebacfg', '小明是个好孩子');

it turns out to be:

server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

what may cause the problem?
what shold i do?

rel_v1.0.1分支,返回分词词性有问题

关于查询 分词词性, eg: select * from ts_debug('jiebacfg','**景城A区') ;
查出来全部是n(名词)词性,查看源码pg_jieba.c文件,发现在下面函数中 type = JB_N;,也就是type一直是2,所以所有词性返回的都是名词,但是注释掉 type = JB_N;取消 type = (int)(curr->attr)[0];的注释,重新编译后,在pg中再次测试 select * from to_tsvector('jiebacfg', '小明硕士毕业于**科学院计算所,后在日本京都大学深造'); 返回结果是空
//相关函数
Datum
jieba_gettoken(PG_FUNCTION_ARGS)
{
ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
char **t = (char **) PG_GETARG_POINTER(1);
int tlen = (int ) PG_GETARG_POINTER(2);
int type = -1;
JiebaResult
curr = Jieba_GetNext(pst->ctx);
/
already done the work, or no sentence */
if (curr == NULL)
{ *tlen = 0;
type = 0;
PG_RETURN_INT32(type);
}
//type = (int)(curr->attr)[0];
type = JB_N;
*tlen = curr->len;
*t = curr->str;

PG_RETURN_INT32(type);

}
另 master (c++版)编译不成功

pg 11.5 不支持

根据这篇文章
http://mysql.taobao.org/monthly/2018/04/10/
做成了docker镜像,
镜像地址
https://github.com/ssfdust/psql_jieba_swsc。

docker pull ssfdust/psql_jieba_swsc
docker run --name psql -e POSTGRES_PASSWORD=passwd -d ssfdust/psql_jieba_swsc

运行日志

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2019-09-27 09:05:36.130 UTC [43] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-09-27 09:05:36.162 UTC [44] LOG:  database system was shut down at 2019-09-27 09:05:23 UTC
2019-09-27 09:05:36.173 UTC [43] LOG:  database system is ready to accept connections
 done
server started

/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/init-dict.sh

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-jieba.sql
2019-09-27 09:05:36.975 UTC [59] LOG:  pg_jieba Extension is not loaded by shared_preload_libraries, Variables can't be configured
2019-09-27 09:05:36.975 UTC [59] STATEMENT:  CREATE EXTENSION pg_jieba;
2019-09-27 09:05:40.973 UTC [43] LOG:  server process (PID 59) was terminated by signal 11: Segmentation fault
2019-09-27 09:05:40.973 UTC [43] DETAIL:  Failed process was running: CREATE EXTENSION pg_jieba;
2019-09-27 09:05:40.973 UTC [43] LOG:  terminating any other active server processes
psql:/docker-entrypoint-initdb.d/init-jieba.sql:1: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
psql:/docker-entrypoint-initdb.d/init-jieba.sql:1: connection to server was lost
2019-09-27 09:05:40.973 UTC [48] WARNING:  terminating connection because of crash of another server process
2019-09-27 09:05:40.973 UTC [48] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2019-09-27 09:05:40.973 UTC [48] HINT:  In a moment you should be able to reconnect to the database and repeat your command.

看起来是服务端在处理pg_jieba的时候直接挂掉了,有什么解决方案吗?或者我下一步应该怎么做?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.