Closed the94air closed 7 years ago
It's embarrassing not to know that it's perfectly fine to close a SQL statement with a semicolon ;)
Sorry i didn't remember the 'semicolon' eng word. Never mind :smiley: . thanks for the info. but i don't know ???? does only 2 queries make my search fast enough? FYI: I am not very familiar with search engines or search engines APIs
Yeah it will make your search super fast. This search package works just like a librarian does. You ask him for a book and he looks it up and brings it from a shelf, without searching the whole library.
Exactly this does TNTSearch
, it has an inverted index where all words from your documents are stored with their positions. So when you search for the word "cat" it knows right away in which documents this word can be found.
From the way that you show me,Yaa it is super fast.And if you add jQuery it is exactly like TNT
it is awesome. can you show me a simple jquey code to do that? Thanks a lot
It's not jQuery :D Try to play with the source code https://github.com/teamtnt/tntsearch-demo
I should preform action when ever i make query. am I right is that the right way to deal with tntseaech EX
$insert = $db->prepare("INSERT INTO `articles`(`title`, `article`, `slug`) VALUES (:title,:article,:slug)");
$insert->execute([
':title' => $title,
':article' => $article,
':slug' => $slug
]);
$article_id = $db->lastInsertId();
$tnt->selectIndex("articles.index");
$index = $tnt->getIndex();
$index->insert([
'id' => $article_id,
'title' => $title,
'article' => $article,
'slug' => $slug
]);
I am having an error when i am insert a very big text. that is causing this error Maximum execution time of 30 seconds exceeded
Seems like you're doing everything wrong :) try to follow one of the tutorials provided on the readme page
I am follow the readme.md tutorials but the problem not in the code. The code is working just fine. i am asking about the Technique.
So whats your question?
Inserting and updating is taking a lot of time causeing this error max execute time of 30 second exceeded
. Should I insert long text as index in TNT search?
Try this:
$index->beginTransaction();
$index->insert([
'id' => $article_id,
'title' => $title,
'article' => $article,
'slug' => $slug
]);
$index->endTransaction();
i think you meant to say
$index->indexBeginTransaction();
$index->insert([
'id' => $article_id,
'title' => $title,
'article' => $article,
'slug' => $slug
]);
$index->indexEndTransaction();
Yes :) Is it faster this way?
Yaa it is super fast. Thanks man 👍
I have add a repository showing how did i use TNTsearch. if you see any thing wrong just tell me :smile: https://github.com/the94air/TNT-search-demo
Yeah, its a good start :) What I would suggest is to learn a little bit about MVC design architecture to better organize your code. After you grasp it, you could write a tutorial to share your knowledge with others
there are some Embarrassing ; in the example query
articles;