Re: Searchable behavior on two models

2010-03-11 Thread Delberto
Sorry, here is the link -->
http://code.google.com/p/searchable-behaviour-for-cakephp/issues/detail?id=19


On Mar 10, 4:16 pm, Foroct  wrote:
> Well it looks like this behaviour can't successfully index two
> different models. Moving back to an old fashioned 'find'.
>
> Thanks all.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-11 Thread Delberto
If you are talking about saving to more than one model with a saveAll
there is a patch here. I haven't tried it myself but you can check it
out

On Mar 10, 4:16 pm, Foroct  wrote:
> Well it looks like this behaviour can't successfully index two
> different models. Moving back to an old fashioned 'find'.
>
> Thanks all.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-10 Thread Jon Bennett
hi,

> Well it looks like this behaviour can't successfully index two
> different models. Moving back to an old fashioned 'find'.

I have the behaviour attached to multiple models, with no issues at
all, not with saving or with retrieving.

There's something amiss elsewhere.

Cheers,

J

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-10 Thread Foroct
Well it looks like this behaviour can't successfully index two
different models. Moving back to an old fashioned 'find'.

Thanks all.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread Foroct
I've looked at the array I am passing when the post gets entered and
its fine. I am saving correctly using $this->Post and the post data
saves to the post table fine.

My models look like this.

User
var $actsAs = array('Searchable' => array(
'fields' => array('username', 'first_name',
'last_name', 'location', 'email')
)
);

var $hasMany = array(
'Post' => array(
'className' => 'Post',
'foreignKey' => 'user_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => Post.created DESC',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'user_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);

Post

var $actsAs = array('Searchable');

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

var $hasMany = array(
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'post_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread cricket
Did you try logging $data? Or check that you're not doing $this->User-
>save(...) instead of $this->Post->save(...)

This is how I have my models set up. You should ignore the 'fields'
array in the behavior settings. I made a bunch of modifications to it.

User:

public $hasMany = array(
'Post' => array(
'className' => 'Post',
'foreignKey' => 'user_id',
'dependent' => true
),
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'user_id',
'dependent' => true
)
);


Post:

public $hasMany = array('Comment');

public $belongsTo = array('User');

public $actsAs = array(
'Tag' => array(
'table_label' => 'tags',
'tag_label' => 'name',
'separator' => ','
),
'Searchable' => array(
'fields' => array('title', 'intro', 'body', 'tags')
),
'Sluggable' => array(
'translation' => 'utf-8',
'separator' => '_',
'label' => 'title',
'length' => 128,
'overwrite' => true
)
);


Comment:

public $belongsTo = array(
'Post',
'User'
);

public $actsAs = array(
'Tree' => array(
'parent' => 'parent_id',
'left' => 'lft',
'right' => 'rght'
),
'Searchable' => array(
'fields' => array('subject', 'body')
)
);

On Mar 8, 9:09 am, Foroct  wrote:
> I thought so after I wrote it out, but when I removed the hasOne
> association I still get the same result.  For some reason when I
> create a post, the post gets added with no problem but the seachable
> fails and kicks an error.
>
> Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
> `modified`, `created`) VALUES ('User', NULL, '', '2010-03-08
> 06:05:15', '2010-03-08 06:05:15')
>
> For some reason even though the model I am updating is the Post model
> when search_index attempts to add a record to its table the User model
> always overrides Post.  Obviously since this is not the correct model
> there is no association_key (the id of the post) so it again fails.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread Foroct
I thought so after I wrote it out, but when I removed the hasOne
association I still get the same result.  For some reason when I
create a post, the post gets added with no problem but the seachable
fails and kicks an error.

Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
`modified`, `created`) VALUES ('User', NULL, '', '2010-03-08
06:05:15', '2010-03-08 06:05:15')

For some reason even though the model I am updating is the Post model
when search_index attempts to add a record to its table the User model
always overrides Post.  Obviously since this is not the correct model
there is no association_key (the id of the post) so it again fails.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread Jon Bennett
> User - hasMany Post and hasMany Comment
>
> Post - belongsTo User and hasMany Comment
>
> Comment - belongsTo User and belongsTo Post and hasOne User

Last one looks wrong to me, I'd expect:

Comment belongsTo Post, User
Post belongsTo User
Post hasMany Comment
User hasMany Comment, Post

cheers,

j


-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-08 Thread Foroct
All three models have the same $actAs array var $actsAs =
array('Searchable');

Each model saves its data properly using if ($this->Model->save($this-
>data)) {

Where it falls apart is after the model data save and prior to the
search_index save.

I have tracked the issue down to something in my model.  I think I am
not setting up my associations correctly particularly in my Comment
model.

User - hasMany Post and hasMany Comment

Post - belongsTo User and hasMany Comment

Comment - belongsTo User and belongsTo Post and hasOne User

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-07 Thread cricket
What do the models look like? Especially the $actsAs arrays.

What does the data look like before you save it? Are you using
saveAll()?

Try adding some debugging calls in the behavior's beforeSave() &
afterSave() methods.

On Mar 6, 4:05 pm, Foroct  wrote:
> Continuing to work on this I have found that when I comment out my
> var $hasMany = array( in my User model, then this searchable plugin
> works fine.
>
>  I tried to comment out the individual keys for this array but that
> did not help.  When I remove the hasMany array then I am able to
> successfully add content however, any queries that rely on that
> hasMany now fail.
>
> Still working on this, still holding out hope that someone can help...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-06 Thread Foroct
Continuing to work on this I have found that when I comment out my
var $hasMany = array( in my User model, then this searchable plugin
works fine.

 I tried to comment out the individual keys for this array but that
did not help.  When I remove the hasMany array then I am able to
successfully add content however, any queries that rely on that
hasMany now fail.

Still working on this, still holding out hope that someone can help...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable behavior on two models

2010-03-03 Thread Foroct
I am continuing to work on this as I want more than one model on my
site searchable.

It looks like the problem is occurring in the Searchable Behavior
setup function.

function setup(&$model, $settings = array()) {
$settings = array_merge($this->_defaults, $settings);
$this->settings[$model->name] = $settings;
$this->model = &$model;
}

For some reason regardless of what model I am using it always gets
returned at the Users model.  Because of this the the id will only
populate correctly when adding a User and not when adding a Post (as
there is no new Post id to return).

Since I didn't hear back from anyone, I'm guessing not many people use
this searchable behavior. But as a n00b I would still appreciate any
insight people have as to why this may be failing.

Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Searchable behavior on two models

2010-03-01 Thread Foroct
I am using this behavior (http://code.google.com/p/searchable-
behaviour-for-cakephp/) on two different models (User and Post).
Searchable is working fine when I add a new user and search for a
user.  I manually populated a few rows of Post data and my search for
a post function works fine. However when I try to add a new post I get
the following errors.

Undefined index: User [APP/models/behaviors/searchable.php, line 77]
Invalid argument supplied for foreach() [APP/models/behaviors/
searchable.php, line 78] SQL Error: 1048: Column 'association_key'
cannot be null [CORE/cake/libs/model/datasources/dbo_source.php, line
525] Query: INSERT INTO `search_index` (`model`, `association_key`,
`data`, `modified`, `created`) VALUES ('User', NULL, '', '2010-02-28
12:04:11', '2010-02-28 12:04:11')

Query: INSERT INTO `search_index` (`model`, `association_key`, `data`,
`modified`, `created`) VALUES ('User', NULL, '', '2010-02-28
12:04:11', '2010-02-28 12:04:11')

Cannot modify header information - headers already sent by (output
started at /home/xxx/example.com/cake/basics.php:307) [CORE/cake/libs/
controller/controller.php, line 644]

So from what I can tell when I add a post something with the user
model is conflicting with my add posts function, as the Query stats
the model value is "user" and not post.  I would expect to see the
query values start with the 'Post' model then the post id and then
some data.

Is there something I need to do when using this behavior on two
different models?  Is there any reason that the behavior thinks I am
inserting User data when in fact I am inserting Post data?

Any help or suggestions would be appreciated.

Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Issues with Searchable Behavior and PHP 4.x.x

2010-02-03 Thread Mayank Singhal
Hi,
I am trying to use Searchable Behaviour hosted here:
http://code.google.com/p/searchable-behaviour-for-cakephp/
To initialize the search_index table with existing data, I have used this:
http://code.google.com/p/searchable-behaviour-for-cakephp/issues/detail?id=1&q=controllerReply
No. 2 which creates the class SearchController.

The code was working fine on my local test server which runs PHP5.
However, the server has PHP 4 and when I tried the code on server it gives
this error:
*Fatal error*: Cannot redeclare class searchcontroller in *
LONG_PATH/cake/app/models/behaviors/searchable.php* on line *2***

Does it really has to do something with the PHP version or have I done some
logical mistake?

Regards and Thanks
-Mayank Singhal

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Searchable Behavior w/ Strings less then 3 characters

2009-05-23 Thread brian

You're using MySQL? Have a look here:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html

On Sat, May 23, 2009 at 2:33 PM, Kyle Decot  wrote:
>
> I am using the Searchable Behavior on my website but I've noticed that
> if someone types something that is 3 characters or shorter, then
> nothing is returned. I understand that this is because FullText search
> is set up this way. Is there any way to change this? I get an awful
> lot of people that search for things like "VA" or "OH" instead of
> Virginia or Ohio and they get no results returned. Thanks for any help
> you can provide.
> >
>

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Searchable Behavior w/ Strings less then 3 characters

2009-05-23 Thread Kyle Decot

I am using the Searchable Behavior on my website but I've noticed that
if someone types something that is 3 characters or shorter, then
nothing is returned. I understand that this is because FullText search
is set up this way. Is there any way to change this? I get an awful
lot of people that search for things like "VA" or "OH" instead of
Virginia or Ohio and they get no results returned. Thanks for any help
you can provide.
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SQL errors with the searchable behavior

2008-10-13 Thread acoustic_overdrive

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

2008-10-13 Thread RyOnLife


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

2008-10-13 Thread RyOnLife


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

2008-10-13 Thread acoustic_overdrive

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

2008-10-13 Thread RyOnLife


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

2008-10-13 Thread Ryan

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
-~--~~~~--~~--~--~---



searchable behavior

2008-09-25 Thread Matsinet

Has anyone got the searchable behavior working correctly with
rebuildOnUpdate set to true?

I am experiencing updates are creating new records in the search_index
table instead of updating the existing index row.

I am looking for a way to troubleshoot the behavior but every time I
put a debug call in the behavior it doesn't do anything.

Any advise would be appreciated.
Matsinet

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---