Re: SQL errors with the searchable behavior
I don't think you should need to set _index or _indexForId, those are private vars used by the Behaviour. Maybe try putting them back to false? Are you trying my version of the code? How about trying an insert rather than an update to see if that at least adds to the index. That's how I've used it so far and it seems to be working. Other than that I suggest you put some little echo 'foo' statements at various places in the behaviour to see what parts of the behaviour are being run (if...else), that might help you track down if something is failing. Let me know if you find any bugs too! AO On Oct 13, 8:56 pm, RyOnLife <[EMAIL PROTECTED]> wrote: > Thanks AO, > > If you make any progress on that rebuild() function, please let me know. > > Rebuilding the entire index aside, my search_index table is not getting any > records added to it even when I do an updateAll() on an indexable field. > I've set $_index, $index_ForId and $rebuildOnUpdate vars at the top of > searchable.php to true. > > Hopefully this will work if I can get the index built! > > > > acoustic_overdrivewrote: > > > Hi RyOnLife, > > > I've been playing with that searchable behaviour recently too and I > > think I've found a few bugs in it. > > > Here's my working copy: > > >http://bin.cakephp.org/view/1556621232 > > > If you DIFF this against the one you have you'll see some of the > > changes I've made. > > > There doesn't seem to be any built-in function for rebuilding the > > index so I'm thinking of writing a function to do that. It's fairly > > clear what's going on so you could probably add a new function called > > rebuild() or something like that. > > > J > > > On Oct 13, 7:08 pm, RyOnLife <[EMAIL PROTECTED]> wrote: > >> I am making a little progress here. I realized $actsAs needs to go in the > >> model, not the controller. That took care of the SQL error. I am still > >> not > >> getting any results, clearly because my search_index table is empty. > > >> I assume that Model::save will take care of the index on inserts and > >> updates, is that correct? But how do I retroactively index the data that > >> already exists in my tables? > > >> RyOnLife wrote: > > >> > I am trying a simple search with the searchable behavior from > >> >http://code.google.com/p/searchable-behaviour-for-cakephp/. > > >> > I've created the table and put the search_index.php file in the models > >> > folder and the searchable.php behavior in the behaviors folder. > > >> > I've got $actsAs in my controller: > > >> > var $actsAs = array('Searchable'); > > >> > And my search() method: > > >> > function search() { > >> > $this->set('results', $this->ModelName->search('test')); > >> > } > > >> > When I run this, I am getting an SQL error because Cake is trying to > >> > execute this query: > > >> > search > > >> > Obviously that's not going to get the job done. > > >> > Any tips for me? Or resources to point me at? > > >> > So far I've referred to the Google Code page and also > >> >http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blo > > >> > Thanks! > > >> -- > >> View this message in > >> context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... > >> Sent from the CakePHP mailing list archive at Nabble.com. > > -- > View this message in > context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL errors with the searchable behavior
When I really started digging in, I realized that since I am only searching on one field per table, I don't even need this behavior. I can make the field a fulltext and then just search on that. I've been on the issues page on the Google Code site, and a guy on there submitted a hack for building an index from scratch. They'd probably appreciate your fixes as well. acoustic_overdrive wrote: > > > I don't think you should need to set _index or _indexForId, those are > private vars used by the Behaviour. Maybe try putting them back to > false? > > Are you trying my version of the code? > > How about trying an insert rather than an update to see if that at > least adds to the index. That's how I've used it so far and it seems > to be working. > > Other than that I suggest you put some little echo 'foo' statements at > various places in the behaviour to see what parts of the behaviour are > being run (if...else), that might help you track down if something is > failing. > > Let me know if you find any bugs too! > > AO > > > > On Oct 13, 8:56 pm, RyOnLife <[EMAIL PROTECTED]> wrote: >> Thanks AO, >> >> If you make any progress on that rebuild() function, please let me know. >> >> Rebuilding the entire index aside, my search_index table is not getting >> any >> records added to it even when I do an updateAll() on an indexable field. >> I've set $_index, $index_ForId and $rebuildOnUpdate vars at the top of >> searchable.php to true. >> >> Hopefully this will work if I can get the index built! >> >> >> >> acoustic_overdrivewrote: >> >> > Hi RyOnLife, >> >> > I've been playing with that searchable behaviour recently too and I >> > think I've found a few bugs in it. >> >> > Here's my working copy: >> >> >http://bin.cakephp.org/view/1556621232 >> >> > If you DIFF this against the one you have you'll see some of the >> > changes I've made. >> >> > There doesn't seem to be any built-in function for rebuilding the >> > index so I'm thinking of writing a function to do that. It's fairly >> > clear what's going on so you could probably add a new function called >> > rebuild() or something like that. >> >> > J >> >> > On Oct 13, 7:08 pm, RyOnLife <[EMAIL PROTECTED]> wrote: >> >> I am making a little progress here. I realized $actsAs needs to go in >> the >> >> model, not the controller. That took care of the SQL error. I am still >> >> not >> >> getting any results, clearly because my search_index table is empty. >> >> >> I assume that Model::save will take care of the index on inserts and >> >> updates, is that correct? But how do I retroactively index the data >> that >> >> already exists in my tables? >> >> >> RyOnLife wrote: >> >> >> > I am trying a simple search with the searchable behavior from >> >> >http://code.google.com/p/searchable-behaviour-for-cakephp/. >> >> >> > I've created the table and put the search_index.php file in the >> models >> >> > folder and the searchable.php behavior in the behaviors folder. >> >> >> > I've got $actsAs in my controller: >> >> >> > var $actsAs = array('Searchable'); >> >> >> > And my search() method: >> >> >> > function search() { >> >> > $this->set('results', $this->ModelName->search('test')); >> >> > } >> >> >> > When I run this, I am getting an SQL error because Cake is trying to >> >> > execute this query: >> >> >> > search >> >> >> > Obviously that's not going to get the job done. >> >> >> > Any tips for me? Or resources to point me at? >> >> >> > So far I've referred to the Google Code page and also >> >> >> >http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blo >> >> >> > Thanks! >> >> >> -- >> >> View this message in >> >> >> context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... >> >> Sent from the CakePHP mailing list archive at Nabble.com. >> >> -- >> View this message in >> context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958018p19964350.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL errors with the searchable behavior
Thanks AO, If you make any progress on that rebuild() function, please let me know. Rebuilding the entire index aside, my search_index table is not getting any records added to it even when I do an updateAll() on an indexable field. I've set $_index, $index_ForId and $rebuildOnUpdate vars at the top of searchable.php to true. Hopefully this will work if I can get the index built! acoustic_overdrive wrote: > > > Hi RyOnLife, > > I've been playing with that searchable behaviour recently too and I > think I've found a few bugs in it. > > Here's my working copy: > > http://bin.cakephp.org/view/1556621232 > > If you DIFF this against the one you have you'll see some of the > changes I've made. > > There doesn't seem to be any built-in function for rebuilding the > index so I'm thinking of writing a function to do that. It's fairly > clear what's going on so you could probably add a new function called > rebuild() or something like that. > > J > > > On Oct 13, 7:08 pm, RyOnLife <[EMAIL PROTECTED]> wrote: >> I am making a little progress here. I realized $actsAs needs to go in the >> model, not the controller. That took care of the SQL error. I am still >> not >> getting any results, clearly because my search_index table is empty. >> >> I assume that Model::save will take care of the index on inserts and >> updates, is that correct? But how do I retroactively index the data that >> already exists in my tables? >> >> >> >> RyOnLife wrote: >> >> > I am trying a simple search with the searchable behavior from >> >http://code.google.com/p/searchable-behaviour-for-cakephp/. >> >> > I've created the table and put the search_index.php file in the models >> > folder and the searchable.php behavior in the behaviors folder. >> >> > I've got $actsAs in my controller: >> >> > var $actsAs = array('Searchable'); >> >> > And my search() method: >> >> > function search() { >> > $this->set('results', $this->ModelName->search('test')); >> > } >> >> > When I run this, I am getting an SQL error because Cake is trying to >> > execute this query: >> >> > search >> >> > Obviously that's not going to get the job done. >> >> > Any tips for me? Or resources to point me at? >> >> > So far I've referred to the Google Code page and also >> >http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blo >> >> > Thanks! >> >> -- >> View this message in >> context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958018p19961714.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL errors with the searchable behavior
Hi RyOnLife, I've been playing with that searchable behaviour recently too and I think I've found a few bugs in it. Here's my working copy: http://bin.cakephp.org/view/1556621232 If you DIFF this against the one you have you'll see some of the changes I've made. There doesn't seem to be any built-in function for rebuilding the index so I'm thinking of writing a function to do that. It's fairly clear what's going on so you could probably add a new function called rebuild() or something like that. J On Oct 13, 7:08 pm, RyOnLife <[EMAIL PROTECTED]> wrote: > I am making a little progress here. I realized $actsAs needs to go in the > model, not the controller. That took care of the SQL error. I am still not > getting any results, clearly because my search_index table is empty. > > I assume that Model::save will take care of the index on inserts and > updates, is that correct? But how do I retroactively index the data that > already exists in my tables? > > > > RyOnLife wrote: > > > I am trying a simple search with the searchable behavior from > >http://code.google.com/p/searchable-behaviour-for-cakephp/. > > > I've created the table and put the search_index.php file in the models > > folder and the searchable.php behavior in the behaviors folder. > > > I've got $actsAs in my controller: > > > var $actsAs = array('Searchable'); > > > And my search() method: > > > function search() { > > $this->set('results', $this->ModelName->search('test')); > > } > > > When I run this, I am getting an SQL error because Cake is trying to > > execute this query: > > > search > > > Obviously that's not going to get the job done. > > > Any tips for me? Or resources to point me at? > > > So far I've referred to the Google Code page and also > >http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blo > > > Thanks! > > -- > View this message in > context:http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: SQL errors with the searchable behavior
I am making a little progress here. I realized $actsAs needs to go in the model, not the controller. That took care of the SQL error. I am still not getting any results, clearly because my search_index table is empty. I assume that Model::save will take care of the index on inserts and updates, is that correct? But how do I retroactively index the data that already exists in my tables? RyOnLife wrote: > > > I am trying a simple search with the searchable behavior from > http://code.google.com/p/searchable-behaviour-for-cakephp/. > > I've created the table and put the search_index.php file in the models > folder and the searchable.php behavior in the behaviors folder. > > I've got $actsAs in my controller: > > var $actsAs = array('Searchable'); > > And my search() method: > > function search() { > $this->set('results', $this->ModelName->search('test')); > } > > When I run this, I am getting an SQL error because Cake is trying to > execute this query: > > search > > Obviously that's not going to get the job done. > > Any tips for me? Or resources to point me at? > > So far I've referred to the Google Code page and also > http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blog-example/. > > Thanks! > > > > -- View this message in context: http://www.nabble.com/SQL-errors-with-the-searchable-behavior-tp19958018p19959831.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
SQL errors with the searchable behavior
I am trying a simple search with the searchable behavior from http://code.google.com/p/searchable-behaviour-for-cakephp/. I've created the table and put the search_index.php file in the models folder and the searchable.php behavior in the behaviors folder. I've got $actsAs in my controller: var $actsAs = array('Searchable'); And my search() method: function search() { $this->set('results', $this->ModelName->search('test')); } When I run this, I am getting an SQL error because Cake is trying to execute this query: search Obviously that's not going to get the job done. Any tips for me? Or resources to point me at? So far I've referred to the Google Code page and also http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blog-example/. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---