2017 © Pedro Peláez
 

library tntsearch-chinese

A fully featured full text search engine written in PHP

image

woodfish/tntsearch-chinese

A fully featured full text search engine written in PHP

  • Thursday, December 15, 2016
  • by woodfish
  • Repository
  • 1 Watchers
  • 2 Stars
  • 155 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 116 Forks
  • 0 Open issues
  • 28 Versions
  • 0 % Grown

The README.md

Latest Version on Packagist Total Downloads ![Software License][ico-license] Build Status Slack Status, (*1)

TNTSearch

A fully featured full text search engine written in PHP, (*2)

TNTSearch Banner, (*3)

Demo

To see TNTSearch in action take a look at the demo page, (*4)

Tutorials

Installation

The easiest way to install TNTSearch is via composer:, (*5)

composer require teamtnt/tntsearch

Requirements

Before you proceed make sure your server meets the following requirements:, (*6)

  • PHP >= 5.5
  • PDO PHP Extension
  • SQLite PHP Extension
  • mbstring PHP Extension

Examples

Creating an index

In order to be able to make full text search queries you have to create an index., (*7)

Usage:, (*8)

use TeamTNT\TNTSearch\TNTSearch;

$tnt = new TNTSearch;

$tnt->loadConfig([
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => 'dbname',
    'username'  => 'user',
    'password'  => 'pass',
    'storage'   => '/var/www/tntsearch/examples/'
]);

$indexer = $tnt->createIndex('name.index');
$indexer->query('SELECT id, article FROM articles;');
//$indexer->setLanguage('german');
$indexer->run();

Important: "storage" settings marks the folder where all of your indexes will be saved so make sure to have permission to write to this folder otherwise you might expect the following exception thrown:, (*9)

  • [PDOException] SQLSTATE[HY000] [14] unable to open database file *

Note: If your primary key is different that id set it like:, (*10)

$indexer->setPrimaryKey('article_id');

Searching

Searching for a phrase or keyword is trivial, (*11)

use TeamTNT\TNTSearch\TNTSearch;

$tnt = new TNTSearch;

$tnt->loadConfig($config);
$tnt->selectIndex("name.index");

$res = $tnt->search("This is a test search", 12);

print_r($res); //returns an array of 12 document ids that best match your query

//to display the results you need an additional query
//SELECT * FROM articles WHERE id IN $res ORDER BY FIELD(id, $res);

The ORDER BY FIELD clause is important otherwise the database engine will not return the results in required order, (*12)

use TeamTNT\TNTSearch\TNTSearch;

$tnt = new TNTSearch;

$tnt->loadConfig($config);
$tnt->selectIndex("name.index");

//this will return all documents that have romeo in it but not juliet
$res = $tnt->searchBoolean("romeo -juliet");

//returns all documents that have romeo or hamlet in it
$res = $tnt->searchBoolean("romeo or hamlet");

//returns all documents that have either romeo AND juliet or prince AND hamlet
$res = $tnt->searchBoolean("(romeo juliet) or (prince hamlet)");

The fuzziness can be tweaked by setting the following member variables:, (*13)

public $fuzzy_prefix_length  = 2;
public $fuzzy_max_expansions = 50;
public $fuzzy_distance       = 2 //represents the levenshtein distance;
use TeamTNT\TNTSearch\TNTSearch;

$tnt = new TNTSearch;

$tnt->loadConfig($config);
$tnt->selectIndex("name.index");
$tnt->fuzziness = true;

//when the fuzziness flag is set to true the keyword juleit will return
//documents that match the word juliet, the default levenshtein distance is 2
$res = $tnt->search("juleit");

Updating the index

Once you created an index you don't need to reindex it each time you make some changes to your document collection. TNTSearch supports dynamic index updates., (*14)

use TeamTNT\TNTSearch\TNTSearch;

$tnt = new TNTSearch;

$tnt->loadConfig($config);
$tnt->selectIndex("name.index");

$index = $tnt->getIndex();

//to insert a new document to the index
$index->insert(['id' => '11', 'title' => 'new title', 'article' => 'new article']);

//to update an existing document
$index->update(11, ['id' => '11', 'title' => 'updated title', 'article' => 'updated article']);

//to delete the document from index
$index->delete(12);

Drivers

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*15)

Credits

License

The MIT License (MIT). Please see License File for more information., (*16)

The Versions

15/12 2016

dev-master

9999999-dev https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar woodfish

search fulltext tntsearch teamtnt

15/12 2016

v1.0.0

1.0.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar woodfish

search fulltext tntsearch teamtnt

09/11 2016

v0.9.0

0.9.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

search fulltext tntsearch teamtnt

24/10 2016

v0.8.9

0.8.9.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

01/10 2016

v0.8.8

0.8.8.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

30/09 2016

v0.8.7

0.8.7.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

21/09 2016

v0.8.6

0.8.6.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

25/08 2016

v0.8.5

0.8.5.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

23/08 2016

v0.8.4

0.8.4.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

19/08 2016

v0.8.3

0.8.3.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

19/08 2016

v0.8.2

0.8.2.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

19/08 2016

v0.8.1

0.8.1.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

20/07 2016

v0.8.0

0.8.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

20/07 2016

v0.7.1

0.7.1.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

13/07 2016

v0.7.0

0.7.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *
  • ext-mbstring *

 

The Development Requires

tntsearch teamtnt

03/07 2016

v0.6.6

0.6.6.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *

 

The Development Requires

tntsearch teamtnt

25/06 2016

v0.6.5

0.6.5.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *

 

The Development Requires

tntsearch teamtnt

21/06 2016

v0.6.4

0.6.4.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *

 

The Development Requires

tntsearch teamtnt

03/06 2016

v0.6.3

0.6.3.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0
  • ext-pdo_sqlite *
  • ext-sqlite3 *

 

The Development Requires

tntsearch teamtnt

28/05 2016

v0.6.2

0.6.2.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

24/05 2016

v0.6.1

0.6.1.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

16/05 2016

v0.6.0

0.6.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

11/05 2016

v0.5.0

0.5.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

09/05 2016

v0.4.1

0.4.1.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

09/05 2016

v0.4.0

0.4.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

27/04 2016

v0.3.0

0.3.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

20/04 2016

v0.2.0

0.2.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt

06/04 2016

v0.1.0

0.1.0.0 https://github.com/teamtnt/tntsearch

A fully featured full text search engine written in PHP

  Sources   Download

MIT

The Requires

  • php ~5.5|~7.0

 

The Development Requires

tntsearch teamtnt