[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8554":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":17,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},8554,"tntsearch","teamtnt\u002Ftntsearch","teamtnt","A fully featured full text search engine written in PHP","https:\u002F\u002Ftnt.studio\u002Fsolving-the-search-problem-with-laravel-and-tntsearch",null,"PHP",3202,295,95,81,0,1,4,29.41,"MIT License",false,"master",true,[25,26,27,28,29,30,31,32,33,34,35,5],"full-text-search","fulltext","fuzzy","fuzzy-matching","fuzzy-search","geo-search","hacktoberfest","laravel-scout","php","search","search-engine","2026-06-12 02:01:55","[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Total Downloads][ico-downloads]][link-downloads]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status](https:\u002F\u002Fimg.shields.io\u002Ftravis\u002Fteamtnt\u002Ftntsearch\u002Fmaster.svg?style=flat-square)](https:\u002F\u002Ftravis-ci.org\u002Fteamtnt\u002Ftntsearch)\n[![Slack Status](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fslack-chat-E01563.svg?style=flat-square)](https:\u002F\u002Ftntsearch.slack.com)\n\n![TNTSearch](https:\u002F\u002Fi.imgur.com\u002FaYKsNYv.png)\n\n# TNTSearch\n\nTNTSearch is a full-text search (FTS) engine written entirely in PHP. A simple configuration allows you to add an amazing search experience in just minutes. Features include:\n\n* Fuzzy search\n* Search as you type\n* Geo-search\n* Text classification\n* Stemming\n* Custom tokenizers\n* Bm25 ranking algorithm\n* Boolean search\n* Result highlighting\n* Dynamic index updates (no need to reindex each time)\n* Easily deployable via Packagist.org\n\nWe also created some demo pages that show tolerant retrieval with n-grams in action.\nThe package has a bunch of helper functions like Jaro-Winkler and Cosine similarity for distance calculations. It supports stemming for English, Croatian, Arabic, Italian, Russian, Portuguese and Ukrainian. If the built-in stemmers aren't enough, the engine lets you easily plugin any compatible snowball stemmer. Some forks of the package even support Chinese. And please contribute other languages!\n\nUnlike many other engines, the index can be easily updated without doing a reindex or using deltas. \n\n**View** [online demo](http:\u002F\u002Ftntsearch.tntstudio.us\u002F) &nbsp;|&nbsp; **Follow us** on\n[Twitter](https:\u002F\u002Ftwitter.com\u002Ftntstudiohr),\nor [Facebook](https:\u002F\u002Fwww.facebook.com\u002Ftntstudiohr) &nbsp;|&nbsp;\n**Visit our sponsors**:\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fm.do.co\u002Fc\u002Fddfc227b7d18\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fimages.prismic.io\u002Fwww-static\u002F49aa0a09-06d2-4bba-ad20-4bcbe56ac507_logo.png?auto=compress,format\" width=\"196.5\" height=\"32\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n## Demo\n\n* [TV Shows Search](http:\u002F\u002Ftntsearch.tntstudio.us\u002F)\n* [PHPUnit Documentation Search](http:\u002F\u002Fphpunit.tntstudio.us)\n* [City Search with n-grams](http:\u002F\u002Fcities.tnt.studio\u002F)\n\n## Tutorials\n\n* [Solving the search problem with Laravel and TNTSearch](https:\u002F\u002Ftnt.studio\u002Fsolving-the-search-problem-with-laravel-and-tntsearch)\n* [Searching for Users with Laravel Scout and TNTSearch](https:\u002F\u002Ftnt.studio\u002Fsearching-for-users-with-laravel-scout-and-tntsearch)\n\n## Premium products\n\nIf you're using TNT Search and finding it useful, take a look at our premium analytics tool:\n\n\n[\u003Cimg src=\"https:\u002F\u002Fi.imgur.com\u002FujagviB.png\" width=\"420px\" \u002F>](https:\u002F\u002Fanalytics.tnt.studio)\n\n## Support us on Open Collective\n\n- [TNTSearch](https:\u002F\u002Fopencollective.com\u002Ftntsearch)\n\n## Installation\n\nThe easiest way to install TNTSearch is via [composer](http:\u002F\u002Fgetcomposer.org\u002F):\n\n```\ncomposer require teamtnt\u002Ftntsearch\n```\n\n## Requirements\n\nBefore you proceed, make sure your server meets the following requirements:\n\n* PHP >= 7.4\n* PDO PHP Extension\n* SQLite PHP Extension\n* mbstring PHP Extension\n\n## Examples\n\n### Creating an index\n\nIn order to be able to make full text search queries, you have to create an index.\n\nUsage:\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig([\n    'driver'    => 'mysql',\n    'host'      => 'localhost',\n    'database'  => 'dbname',\n    'username'  => 'user',\n    'password'  => 'pass',\n    'storage'   => '\u002Fvar\u002Fwww\u002Ftntsearch\u002Fexamples\u002F',\n    'stemmer'   => \\TeamTNT\\TNTSearch\\Stemmer\\PorterStemmer::class\u002F\u002Foptional\n]);\n\n$indexer = $tnt->createIndex('name.index');\n$indexer->query('SELECT id, article FROM articles;');\n\u002F\u002F$indexer->setLanguage('german');\n$indexer->run();\n\n```\n\nImportant: \"storage\" settings marks the folder where all of your indexes\nwill be saved so make sure to have permission to write to this folder otherwise\nyou might expect the following exception thrown:\n\n* [PDOException] SQLSTATE[HY000] [14] unable to open database file *\n\nNote: If your primary key is different than `id` set it like:\n\n```php\n$indexer->setPrimaryKey('article_id');\n```\n\n### Making the primary key searchable\n\nBy default, the primary key isn't searchable. If you want to make it searchable, simply run:\n\n\n```php\n$indexer->includePrimaryKey();\n```\n\n### Searching\n\nSearching for a phrase or keyword is trivial:\n\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig($config);\n$tnt->selectIndex(\"name.index\");\n\n$res = $tnt->search(\"This is a test search\", 12);\n\nprint_r($res); \u002F\u002Freturns an array of 12 document ids that best match your query\n\n\u002F\u002F to display the results you need an additional query against your application database\n\u002F\u002F SELECT * FROM articles WHERE id IN $res ORDER BY FIELD(id, $res);\n```\n\nThe ORDER BY FIELD clause is important, otherwise the database engine will not return\nthe results in the required order.\n\n### Boolean Search\n\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig($config);\n$tnt->selectIndex(\"name.index\");\n\n\u002F\u002Fthis will return all documents that have romeo in it but not juliet\n$res = $tnt->searchBoolean(\"romeo -juliet\");\n\n\u002F\u002Freturns all documents that have romeo or hamlet in it\n$res = $tnt->searchBoolean(\"romeo or hamlet\");\n\n\u002F\u002Freturns all documents that have either romeo AND juliet or prince AND hamlet\n$res = $tnt->searchBoolean(\"(romeo juliet) or (prince hamlet)\");\n\n```\n\n### Fuzzy Search\n\nThe fuzziness can be tweaked by setting the following member variables:\n\n```php\npublic $fuzzy_prefix_length  = 2;\npublic $fuzzy_max_expansions = 50;\npublic $fuzzy_distance       = 2; \u002F\u002Frepresents the Levenshtein distance;\n```\n\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig($config);\n$tnt->selectIndex(\"name.index\");\n$tnt->fuzziness(true);\n\n\u002F\u002Fwhen the fuzziness flag is set to true, the keyword juleit will return\n\u002F\u002Fdocuments that match the word juliet, the default Levenshtein distance is 2\n$res = $tnt->search(\"juleit\");\n\n```\n## Updating the index\n\nOnce you created an index, you don't need to reindex it each time you make some changes \nto your document collection. TNTSearch supports dynamic index updates.\n\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig($config);\n$tnt->selectIndex(\"name.index\");\n\n$index = $tnt->getIndex();\n\n\u002F\u002Fto insert a new document to the index\n$index->insert(['id' => '11', 'title' => 'new title', 'article' => 'new article']);\n\n\u002F\u002Fto update an existing document\n$index->update(11, ['id' => '11', 'title' => 'updated title', 'article' => 'updated article']);\n\n\u002F\u002Fto delete the document from index\n$index->delete(12);\n```\n\n## Custom Tokenizer\nFirst, create your own Tokenizer class. It should extend AbstractTokenizer class, define \nword split $pattern value and must implement TokenizerInterface:\n\n``` php\n\nuse TeamTNT\\TNTSearch\\Tokenizer\\AbstractTokenizer;\nuse TeamTNT\\TNTSearch\\Tokenizer\\TokenizerInterface;\n\nclass SomeTokenizer extends AbstractTokenizer implements TokenizerInterface\n{\n    static protected $pattern = '\u002F[\\s,\\.]+\u002F';\n\n    public function tokenize($text) {\n        return preg_split($this->getPattern(), strtolower($text), -1, PREG_SPLIT_NO_EMPTY);\n    }\n}\n```\n\nThis tokenizer will split words using spaces, commas and periods.\n\nAfter you have the tokenizer ready, you should pass it to `TNTIndexer` via `setTokenizer` method.\n\n``` php\n$someTokenizer = new SomeTokenizer;\n\n$indexer = new TNTIndexer;\n$indexer->setTokenizer($someTokenizer);\n```\n\nAnother way would be to pass the tokenizer via config:\n\n```php\nuse TeamTNT\\TNTSearch\\TNTSearch;\n\n$tnt = new TNTSearch;\n\n$tnt->loadConfig([\n    'driver'    => 'mysql',\n    'host'      => 'localhost',\n    'database'  => 'dbname',\n    'username'  => 'user',\n    'password'  => 'pass',\n    'storage'   => '\u002Fvar\u002Fwww\u002Ftntsearch\u002Fexamples\u002F',\n    'stemmer'   => \\TeamTNT\\TNTSearch\\Stemmer\\PorterStemmer::class, \u002F\u002F optional\n    'tokenizer' => \\TeamTNT\\TNTSearch\\Tokenizer\\SomeTokenizer::class\n]);\n\n$indexer = $tnt->createIndex('name.index');\n$indexer->query('SELECT id, article FROM articles;');\n$indexer->run();\n\n```\n\n## Geo Search\n\n### Indexing\n\n```php\n$candyShopIndexer = new TNTGeoIndexer;\n$candyShopIndexer->loadConfig($config);\n$candyShopIndexer->createIndex('candyShops.index');\n$candyShopIndexer->query('SELECT id, longitude, latitude FROM candy_shops;');\n$candyShopIndexer->run();\n```\n### Searching\n\n```php\n$currentLocation = [\n    'longitude' => 11.576124,\n    'latitude'  => 48.137154\n];\n\n$distance = 2; \u002F\u002Fkm\n\n$candyShopIndex = new TNTGeoSearch();\n$candyShopIndex->loadConfig($config);\n$candyShopIndex->selectIndex('candyShops.index');\n\n$candyShops = $candyShopIndex->findNearest($currentLocation, $distance, 10);\n```\n\n## Classification\n\n```php\nuse TeamTNT\\TNTSearch\\Classifier\\TNTClassifier;\n\n$classifier = new TNTClassifier();\n$classifier->learn(\"A great game\", \"Sports\");\n$classifier->learn(\"The election was over\", \"Not sports\");\n$classifier->learn(\"Very clean match\", \"Sports\");\n$classifier->learn(\"A clean but forgettable game\", \"Sports\");\n\n$guess = $classifier->predict(\"It was a close election\");\nvar_dump($guess['label']); \u002F\u002Freturns \"Not sports\"\n\n```\n\n### Saving the classifier\n\n```php\n$classifier->save('sports.cls');\n```\n\n### Loading the classifier\n\n```php\n$classifier = new TNTClassifier();\n$classifier->load('sports.cls');\n```\n\n## Drivers\n\n* [TNTSearch Driver for Laravel Scout](https:\u002F\u002Fgithub.com\u002Fteamtnt\u002Flaravel-scout-tntsearch-driver)\n\n## PS4Ware \u002F PS5Ware\n\nYou're free to use this package, but if it makes it to your production environment, we would highly appreciate you sending us a PS4\u002FPS5 game of your choice. This way you support us to further develop and add new features.\n\nOur address is: TNT Studio, Sv. Mateja 19, 10010 Zagreb, Croatia.\n\nWe'll publish all received games [here][link-ps4ware]\n\n[link-ps4ware]: https:\u002F\u002Fgithub.com\u002Fteamtnt\u002Ftntsearch\u002Fblob\u002Fmaster\u002FPS4Ware.md\n\n## Support [![OpenCollective](https:\u002F\u002Fopencollective.com\u002Ftntsearch\u002Fbackers\u002Fbadge.svg)](#backers) [![OpenCollective](https:\u002F\u002Fopencollective.com\u002Ftntsearch\u002Fsponsors\u002Fbadge.svg)](#sponsors)\n\n\u003Ca href='https:\u002F\u002Fko-fi.com\u002FO4O3K2R9' target='_blank'>\u003Cimg height='36' style='border:0px;height:36px;' src='https:\u002F\u002Faz743702.vo.msecnd.net\u002Fcdn\u002Fkofi4.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' \u002F>\u003C\u002Fa>\n\n### Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https:\u002F\u002Fopencollective.com\u002Ftntsearch#backer)]\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https:\u002F\u002Fopencollective.com\u002Ftntsearch#sponsor)]\n\n## Credits\n\n- [Nenad Tičarić][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fv\u002Fteamtnt\u002Ftntsearch.svg?style=flat-square\n[ico-license]: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-brightgreen.svg?style=flat-square\n[ico-downloads]: https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fteamtnt\u002Ftntsearch.svg?style=flat-square\n\n[link-packagist]: https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fteamtnt\u002Ftntsearch\n[link-downloads]: https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fteamtnt\u002Ftntsearch\n[link-author]: https:\u002F\u002Fgithub.com\u002Fnticaric\n[link-contributors]: ..\u002F..\u002Fcontributors\n\n---\nFrom Croatia with ♥ by TNT Studio ([@tntstudiohr](https:\u002F\u002Ftwitter.com\u002Ftntstudiohr), [blog](https:\u002F\u002Ftnt.studio))\n","TNTSearch 是一个完全用 PHP 编写的全文搜索引擎。它支持模糊搜索、实时搜索、地理位置搜索、文本分类、词干提取、自定义分词器以及 BM25 排名算法等核心功能。TNTSearch 提供了动态索引更新能力，无需每次重新建立索引，这使得其非常适合需要快速部署和维护的搜索场景。此外，它还集成了 Laravel Scout 支持，并提供了诸如结果高亮显示等功能来增强用户体验。此项目适合于任何希望在 PHP 应用中集成强大且易于使用的搜索功能的开发者或团队使用。",2,"2026-06-11 03:18:35","top_language"]