-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propose a tutorial #118
Comments
A complete example, like searching a Post model or anything like that would be more helpful. |
I'd like to know if the initial seed of the index from a db can be skipped.... and just add new records on the fly. Ie a tutorial for using it without a source db. |
@OGhawsi http://tnt.studio/blog/searching-for-bobby-fisher-with-laravel-5 is there something that's not clear from this tutorial? If yes, please suggest on how to improve it. @syntaxseed I don't think that there needs to be a special tutorial for this, when you insert your first record, do your first index then and that's it :) |
@syntaxseed I'd imagine you'd need an empty .sqllite file i.e. "products.sqlite". I don't see why you wouldn't want to create the index full initially and then follow https://github.com/teamtnt/tntsearch#updating-the-index to update the index as items are added. |
@ultrono My data, as it exists in the DB is not in a format ready to be indexed. For example, the text contains BBCODES kind of like [snippet=12] which insert text snippets stored in other tables. It's only the 'published' version of the data that makes sense to index. But that is stored in JSON files. Soooo I was hoping to start with an empty index, and then just add records as the publishing process creates them, but before they are saved as JSON. Ie... that intermediary stage in memory in which all snippets are inserted, but before it's in json format. This is why I was looking for an indexing solution instead of just doing queries on the database. |
@syntaxseed I have an older version of TNT search here and I'm able to insert records one by one, into an empty sqlite file. Is that was you're referring to? |
@ultrono Yes!! |
@syntaxseed Try Depending upon your server setup/permissions you may need to manually create the raw file from the command line: |
@nticaric implementing ACL would be an awesome tutorial: ie, searching a given query might return different results based on the roles / permissions the users have (we don't want to show link to threads they don't have access to, for example). |
@pmartelletti TNT Search shouldn't be responsible for ACL. You'd implement ACL yourself. You'd either add an extra where clause to the resulting Eloquent query, or (less efficiently) filter the resulting Eloquent collection i.e.
Or you could make use of a relation on your model:
However, all this is going off topic a little as ACL is not TNT's responsibility. |
@OGhawsi this tutorial http://tnt.studio/blog/searching-for-bobby-fisher-with-laravel-5 has a total of 5 lines of code if you don't count the configuration file, I can't possibly see how easier a tutorial should be than adding 5 lines of code in 2 files :) If there is something that is not clear from those tutorials or from the documentation please let us know. Could you give us an example of the tutorial (url) which is more simple than the one with 5 lines of code? :) |
@OGhawsi If you're using the TNT Search Scout driver there is next to no difference to implementing Agolia and TNT Search - it's just configuration changes using the same API. If implementing TNT Search stand alone the readme at https://github.com/teamtnt/tntsearch and the tests folder at https://github.com/teamtnt/tntsearch/tree/master/tests contain all the code you could require - the code is literally written for you. What are you missing exactly as all the code is there for you. |
I am trying one of the tutorials on tntstudio: Searching for Bobby Fisher with Laravel 5 Any idea how to fix |
@OGhawsi When using code on Github I'd strongly advise reading at least the readme and browsing the tests folder. The error is very self explanatory - you are trying to call the none static Usage is explained in the readme for this repo i.e. https://github.com/teamtnt/tntsearch#creating-an-index
|
Thanks @ultrono for your advice and help, I solved that. // to display the results you need an additional query against your application database I am trying to display the results in view but the search does not return a single array of ids, instead it returns a multidimensional array which contains ids[ ], hits[ ], execution time[ ]. Here is my query: `
` This throws an error: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined (SQL: select * from "users" where "id" in (1, 6, 13) order by "id" asc) Thanks so much in advance, you guys are really good. |
@OGhawsi If you're using Laravel Scout, that query doesn't apply. Laravel handles that for you. If using TNT search stand alone you'll need to do something like the following with the ids IIRC:
|
@ultrono I am using Laravel Scout, so how should I do that. Thanks. |
@OGhawsi Firstly you're commenting on the wrong repo if you're using Scout :) IF using Scout you don;t need to worry about writing the query are per the Laravel Scout documentation. I would highly recommend spending 5 or 10 mins reading the Laravel docs on this topic as it is very clearly explained, see https://laravel.com/docs/5.5/scout#searching. Whatever the Scout driver you use, the same API applies applies. When using Scout there really isn't anything to it, all the hard work has been done for you. |
Greetings. Can you, please, explain how can I implement range search within a free text query. Query example:
Is there a way to define operators, synonyms and maybe ignored words? Thank you in advance! PS: Also it would be nice to have a more advanced documentation with |
Is there a way to use mysql instead of sqlite? If so, how do you configure that? |
I am new to TNTSearch and have problems already with a normal start. The documentation is insufficient (or I am stupid). Tutorials online are rare.
I would like to index and search through a MySQL database that holds How to start? |
read the readme or any of the tutorials mentioned there...
…On Mon, Jun 19, 2023 at 3:46 PM q2apro ***@***.***> wrote:
I am new to TNTSearch and have problems already with a normal start. The
documentation is insufficient. Tutorials online are rare.
1. I don't use Laravel, so I would need a pure PHP installation guide.
2. How to start?
3. A full walkthrough would be the best help.
I would like to go throught a MySQL database that holds title, content
and tags columns. Similar to a blog.
How to start?
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWSESWZFC7TLY6AGIYLXMBJ4FANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It is not pure php, always Laravel. Imagine I give you an FTP client and PHPmyadmin. How would you start?! Suggest a link please. |
no, the whole readme https://github.com/teamtnt/tntsearch doesn't mentione
Laravel, it's pure php.
…On Mon, Jun 19, 2023 at 3:49 PM q2apro ***@***.***> wrote:
It is not pure php, always Laravel.
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWW2GC4HMTBDSTJYK5LXMBKHPANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It starts with Why not to start with "Upload the folder xyz to your server, then create a file abc.php, then put this code into the file"? It is sad that great projects are not used by so many developers because the first steps are not described and not clarified. |
I understand your concern. As a friendly suggestion, I would encourage you to consider using Composer for your project. It's a widely adopted tool that greatly simplifies dependency management in PHP. Without Composer, it could become increasingly difficult to manually manage and update libraries in your project, which might lead to compatibility issues down the road. Learning to use Composer could significantly enhance the maintainability of your project and is considered a best practice in modern PHP development. I hope this suggestion will contribute to the success of your project. Please feel free to ask if you have any questions about Composer or dependency management in general. As for the use TeamTNT\TNTSearch\TNTSearch; statement, this is not specific to Composer but is part of PHP's namespace system, which is used to avoid naming conflicts between different pieces of code. The use statement allows you to refer to a class using a shorter name instead of the full namespace. Lastly, while the suggestion of uploading a folder and creating a file can work for smaller projects or scripts, it becomes infeasible for larger, more complex projects that use many external libraries and need to manage dependencies between them. Composer is a tool that is designed to manage this complexity, making it easier to build, maintain, and collaborate on PHP projects. |
because if you are using a package it's assumed that you know how to use
Composer, if not first go learn that.
Also why should we upload anything if we are developing locally?
Feel free to write your own tutorial, after all you are a developer if you
need this package :)
…On Mon, Jun 19, 2023 at 4:11 PM q2apro ***@***.***> wrote:
It starts with use TeamTNT\TNTSearch\TNTSearch; ...
Why not to start with "Upload the folder xyz to your server, then create a
file abc.php, then put this code into the file"?
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWTX6LBTQC464LPWL6LXMBM2BANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
If you have no SSH rights, and only FTP client and PHPmyadmin (no composer), it seems, that TNTSearch is not the right choice. Sad because many developers are using only tools like that. |
you could always download the source, but you should know that as a
developer....
…On Mon, Jun 19, 2023 at 4:20 PM q2apro ***@***.***> wrote:
If you have no SSH rights, and only FTP client and PHPmyadmin (no
composer), it seems, that TNTSearch is not the right choice.
Sad.
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWWJGHLHM2FU7FESMNTXMBNZHANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
When I see a project that is many years old and there is not any advice how to start under the circumstances described, and just a comment "you are a developer, find out yourself", I really wonder why, and what happened all those years. I just asked how to start. And I didn't receive any help. |
Here is a good and simple example: https://github.com/phpsearch/library#without-composer |
In all of those years nobody had any trouble setting it up or understanding
what it does or how it does it.
Asking basic questions like “how do I xyz if I dont have ssh” are clearly
out of scope of this package. The same goes for ANY php package.
The readme is more than enough to start, if you are aware of shared hosting
limitations then you should be able to figure out how to overcome them, I
would love to read about it :)
…On Mon, 19 Jun 2023 at 17:00, q2apro ***@***.***> wrote:
When I see a project that is many years old and there is not any advice
how to start under the circumstances described, and just a comment "you are
a developer, find out yourself", I really wonder why, and what happened all
those years.
I just asked how to start. And I didn't receive any help.
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWXPMFQVWO3KHBZLQHDXMBSPNANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I glanced over the code. Well written. However, one thing I noticed is that there are DB tables Those tables should have prefixes to not colide with other tables in the same database. I recommend to use Update:
So no prefixes are needed. Thanks @stokic |
Tntsearch uses sqlite for it’s indexes, it has nothing to collide with…
…On Tue, 20 Jun 2023 at 06:06, q2apro ***@***.***> wrote:
I glanced over the code. Well written.
However, one thing I noticed is that there are DB tables
<https://github.com/teamtnt/tntsearch/blob/master/src/Indexer/TNTIndexer.php>
wordlist, doclist, fields, hitlist, info.
Those tables should have prefixes to not colide with other tables in the
same database.
I recommend to use tnt_ as a prefix for all of them.
—
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQMGWTKTAFWAMNRWCZWK7DXMEOULANCNFSM4EDG74MQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
If you have a topic you would like to read about and how to do it using TNTSearch, propose it here and we'll try to write a tutorial about it
The text was updated successfully, but these errors were encountered: