GithubHelp home page GithubHelp logo

Full Text Search about canvas HOT 36 CLOSED

austintoddj avatar austintoddj commented on May 18, 2024 2
Full Text Search

from canvas.

Comments (36)

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

Yes that's fine.

from canvas.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

@nticaric Is this something that would be addressed in the config or .env file?
screen shot 2016-07-15 at 2 55 46 pm

from canvas.

nticaric avatar nticaric commented on May 18, 2024

Here's how the tntsearch config looks like

tntsearch

which means you need to have the DB_CONNECTION environment variable set

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

Two things. First, I get this error when trying to save a new post:

screen shot 2016-07-15 at 3 05 52 pm

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.

austintoddj avatar austintoddj commented on May 18, 2024

Also can't seem to pull any results from a search at all.

from canvas.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

Will do! I'll give it a go tonight. Thanks for working on this with me!

from canvas.

nticaric avatar nticaric commented on May 18, 2024

Hey @austintoddj, did you had any chance to look into this?

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

Have not yet, my apologies. Hoping to tonight however. Should see the merge soon! :)

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

@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.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

Hmm, this doesn't happen to me. Is it possible that you're running the seeder 2 times?

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

Right now the only thing that I can think of are those permissions, everything else should be ok.

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

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.

austintoddj avatar austintoddj commented on May 18, 2024

Nice work on this @nticaric. Love the feature, works great. Referenced TNTSearch in the readme as well.

from canvas.

vhanla avatar vhanla commented on May 18, 2024

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.

nticaric avatar nticaric commented on May 18, 2024

Does the post contain some binary data, or base64 encoded, like inline images?

from canvas.

vhanla avatar vhanla commented on May 18, 2024

Just the sample Hello World post

from canvas.

nticaric avatar nticaric commented on May 18, 2024

@vhanla can you check the post content to see how it looks in the database?

from canvas.

austintoddj avatar austintoddj commented on May 18, 2024

@nticaric Thanks for jumping in on this right away!

from canvas.

vhanla avatar vhanla commented on May 18, 2024

@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.

austintoddj avatar austintoddj commented on May 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.