Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/postgrespro/pg_tsparser
pg_tsparser - parser for text search
https://github.com/postgrespro/pg_tsparser
parser postgresql
Last synced: 2 months ago
JSON representation
pg_tsparser - parser for text search
- Host: GitHub
- URL: https://github.com/postgrespro/pg_tsparser
- Owner: postgrespro
- License: other
- Created: 2017-03-24T08:28:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T13:13:05.000Z (3 months ago)
- Last Synced: 2024-10-29T15:57:48.764Z (3 months ago)
- Topics: parser, postgresql
- Language: C
- Size: 49.8 KB
- Stars: 16
- Watchers: 29
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pg_tsparser - parser for text search
## Introduction
The **pg_tsparser** module is the modified default text search parser from
PostgreSQL 9.6. The differences are:
* **tsparser** gives unbroken words by underscore character
* **tsparser** gives unbroken words with numbers and letters by hyphen characterFor example:
```sql
SELECT to_tsvector('english', 'pg_trgm') as def_parser,
to_tsvector('english_ts', 'pg_trgm') as new_parser;
def_parser | new_parser
-----------------+-----------------------------
'pg':1 'trgm':2 | 'pg':2 'pg_trgm':1 'trgm':3
(1 row)SELECT to_tsvector('english', '123-abc') as def_parser,
to_tsvector('english_ts', '123-abc') as new_parser;
def_parser | new_parser
-----------------+-----------------------------
'123':1 'abc':2 | '123':2 '123-abc':1 'abc':3
(1 row)SELECT to_tsvector('english', 'rel-3.2-A') as def_parser,
to_tsvector('english_ts', 'rel-3.2-A') as new_parser;
def_parser | new_parser
------------------+-------------------------------
'-3.2':2 'rel':1 | '3.2':3 'rel':2 'rel-3.2-a':1
(1 row)
```## License
This module available under the [license](LICENSE) similar to
[PostgreSQL](http://www.postgresql.org/about/licence/).## Installation
Typical installation procedure may look like this:
$ cd pg_tsparser
$ sudo make USE_PGXS=1 install
$ make USE_PGXS=1 installcheck
$ psql DB -c "CREATE EXTENSION pg_tsparser;"After this you can create your own text search configuration:
```sql
CREATE TEXT SEARCH CONFIGURATION english_ts (
PARSER = tsparser
);COMMENT ON TEXT SEARCH CONFIGURATION english_ts IS 'text search configuration for english language';
ALTER TEXT SEARCH CONFIGURATION english_ts
ADD MAPPING FOR email, file, float, host, hword_numpart, int,
numhword, numword, sfloat, uint, url, url_path, version
WITH simple;ALTER TEXT SEARCH CONFIGURATION english_ts
ADD MAPPING FOR asciiword, asciihword, hword_asciipart,
word, hword, hword_part
WITH english_stem;
```