Comments (36)
I'd love to have a more fleshed out search. Right now, it is restricted to only posts and tags. There is much room for improvement! So yes, if you'd like to tackle this feature and send me a PR, I'd be more than happy to include it in the project. Let me know if you have any questions or need anything.
from canvas.
Ok great! The dependencies of TNTSearch are
- PHP >= 5.5
- PDO PHP Extension
- SQLite PHP Extension
- mbstring PHP Extension
So if we include it, canvas will also depend on it, are you ok with this?
from canvas.
Yes that's fine.
from canvas.
I guess we can close this one now. If someone experiences a bug with the search, feel free to assign the issue to me.
from canvas.
@nticaric Is this something that would be addressed in the config or .env
file?
from canvas.
Here's how the tntsearch config
looks like
which means you need to have the DB_CONNECTION
environment variable set
from canvas.
Two things. First, I get this error when trying to save a new post:
Second: The PHPUnit tests significantly slowed down. The unit tests are using a SQLite database in memory to run tests rapidly. Any thoughts on these?
from canvas.
Also can't seem to pull any results from a search at all.
from canvas.
It seems like the folder where the database resides doesn't have write permissions. Can you please check if the folder and the index itself is writable. The default folder where the index resides is storage
. The files are posts.index
and tags.index
If the script failed to write to those indexes the search results will be empty
from canvas.
Yup I'll do that right away. FYI I just created a revert pull request, because I was hasty and just pulled everything in without testing myself. So I'm just reverting for a tiny bit while I do as much testing as I can and then I'll just have you send me a pull request again. Sorry for the confusion, I just should have been more thorough with my processes. But everything looks GREAT so far, and I'll gladly pull this in as soon as I run through it :)
from canvas.
Ok, no problem. I think that the problem here were only the permissions.
About the unit test speed. The index files are updated each time an update/insert/delete is made to the posts or tags table. Since the tests do a lot of those actions, they are slowed down because the index resides on disk and writing to the disk is a lot slower than to memory.
We have several options for this:
- we can remove the automatic updates/deletes/inserts and the user needs to run
php artisan canvas:indexer
if he wants to reindex - we remove the automatic updates/deletes/inserts and the user has an gui option for reindex
- we can remove the automatic updates/deletes/inserts only for phpunit by doing an if env = testing
from canvas.
Thanks for the explanation, it really helps. I think I like the 3rd option, since in a testing environment we are just looking for application functionality, and there won't really be a need to search for anything. So I think we'd be safe going that route.
As far as the permissions, is there anything we need to add to the readme.md
for users on setting Canvas up, or will it just work?
Last, we'd need to update the .env.example with a DB_CONNECTION variable right?
from canvas.
I think you're already telling users to make the storage directory writable in the readme file.
Some systems, but rare ones, set an crazy umask for file creation that make the files readonly, so we could put a sentence that the two index files in the storage directory need to be writable.
Maybe it's better to change the tntsearch config file and default it to mysql env('DB_CONNECTION', 'mysql')
because most users have mysql
as their default database, and if not, either way, they have to add it manually to the .env file
from canvas.
Ok. Let's leave the current storage directory permissions statement in the readme
alone for now. Could you go ahead and add the DB_CONNECTION
to .env.example with a default of mysql
? That way, it'll be pretty apparent for anyone not familiar with what's going on that their connection is set to mysql
from canvas.
Yes, I allready did that. Try to clone my fork and test it, and if everything goes smoothly, I'll send you a pull request, if not, we'll try to fix it ;)
https://github.com/nticaric/Canvas
from canvas.
Will do! I'll give it a go tonight. Thanks for working on this with me!
from canvas.
Hey @austintoddj, did you had any chance to look into this?
from canvas.
Have not yet, my apologies. Hoping to tonight however. Should see the merge soon! :)
from canvas.
Ok so I'm still getting the error Attempting to write a readonly database. Any thoughts @nticaric? Post index and tag index both have contents.
from canvas.
This must be due to your write permissions, the index file needs to be writable. Can you try to manually set it to ie. 777
from canvas.
@nticaric Ok awesome, think I've got it all working. You were right. Even though the storage folder is modified during the setup, the addition of the files at a later time means they aren't 777 like the directory was set. So it just means modifying the permissions again. Just making a couple more tests.
from canvas.
One other thing, looks like when I run the migrations and seed the database now, I get 2 duplicate tags attached to the 1 post. Have you run into this?
from canvas.
Hmm, this doesn't happen to me. Is it possible that you're running the seeder 2 times?
from canvas.
Ah it's actually when I run canvas:install
. Would you try running that command and see if you get it as well?
from canvas.
Each time the command canvas:install
is run it adds a record to the post_tag_pivot
table.
This is because the PostTagPivotTableSeeder
doesn't truncate the table
from canvas.
Ah good catch! Do you want to add the truncate to your PR? Also, just trying to think of all the possibilities for error people could run into installing this. Is there anything in the setup process or steps that you can think of need to be addressed before we pull this in? If not, I think we're ready to go if you just send me a PR again.
from canvas.
Right now the only thing that I can think of are those permissions, everything else should be ok.
from canvas.
Ok great. As soon as those tests are run, I'll merge it in. I'll re-arrange some steps in the readme
and that should take care of any issues people could run into.
from canvas.
Nice work on this @nticaric. Love the feature, works great. Referenced TNTSearch in the readme
as well.
from canvas.
Every time I create or update a post it takes long time and it show FatalErrorException in TNTIndexer.php line 291 - Maximum execution time of 30 seconds exceeded.
from canvas.
Does the post contain some binary data, or base64 encoded, like inline images?
from canvas.
Just the sample Hello World post
from canvas.
@vhanla can you check the post content to see how it looks in the database?
from canvas.
@nticaric Thanks for jumping in on this right away!
from canvas.
@nticaric I just reinstalled a new empty project with composer create-project
method, then accessed the admin and retried to edit the "Hello World" post, nothing really edited, just pressed 'Save' and it brought the same error.
Maybe it has to do with my current computer setup:
I'm using PHP 7.0.6 with Apache HttpServer 2.4 both 32bits running on Windows 10 x64.
PHP.ini extensions enabled : mbstring, pdo_sqlite, sqlite3.
Finally I changed PHPs script execution time to 130 seconds and it worked, but I had to wait almost those 130 seconds. I suppose it takes its time to do its job. Hopefully in my real server it will not take that long to post/update a post, since - locally - I'm using a "not really fast laptop" neither a Unix/Linux OS.
Anyway, thank you very much for your concern.
from canvas.
@vhanla Glad you got it working. And just for a comparison, when I run the same routine on a very basic production server, it only takes about 1-1.5 seconds to complete.
from canvas.
Related Issues (20)
- how to deploy to vercel or netlify? HOT 1
- how to use spatie pkg https://github.com/spatie/laravel-export with canvas for static site HOT 2
- Is there an artisan command to regenerate an admin user? HOT 1
- Endless loop HOT 2
- How to remove /canvas-ui from url? HOT 1
- Embed Code content doesn't use <pre> tag
- Empty CANVAS_PATH breaks the image uploads HOT 1
- PostStats@getDefaultFavicon returns an error
- is it possible to add new page/module like posts and tags module? HOT 1
- Migration guide from themsaid's wink to canvas
- Ability to create Page HOT 2
- Addin a RSS Feed URL for Post Feed
- Adding a sitemap.xml URL for SEO
- GCP Cloud Storage Bucket with Laravel Spatie HOT 7
- Vendor folder gives 404 HOT 3
- Does not work if you have Vue3 installed HOT 2
- Create a Model Factory for Canvas Posts HOT 2
- Invalid text representation: canvas_users:id -> sessions:user_id HOT 2
- Laravel 11 | Warning 1265 Data truncated for 'user_id' HOT 4
- Meta tags for topics and tags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canvas.