Re: __search works in mysterious ways.
On Mar 19, 11:41 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 3/19/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > That's not what I would have expected to see. Have a look at the SQL > > that Django is generating and see if there are any clues there. To do > > that, make sure you have DEBUG=True in your settings file (which you > > will have by default) and then do this: > > That's actually the correct behavior on MySQL -- it defaults to > ignoring words of less than four characters in full-text searches (it > also ignores "stop words"). > > These are configurable in MySQL via the 'ft_min_word_len' and > 'ft_stopword_file' options. hmm, I see, thanks. setting 'ft_min_word_len=2 solved it. still pretty annoying. could django take care of changing this setting? (assuming that this is not how __search is supposed to work). thanks -abe > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: __search works in mysterious ways.
On Mar 19, 11:15 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-03-19 at 14:09 +, abe wrote: > > I'm getting unexpected (missing) results from the __search field > > lookup > > it looks like it can only finds whole words, but only if they're > > larger than > > 3 chars. is this correct? and is it supposed to work like this? > > > In [65]: c.choice='ABC123\ncde456' > > > In [66]: c.save() > > > In [67]: Choice.objects.filter(choice__search='abc123') > > Out[67]: > > [ABC123 > > cde456] > > > In [68]: c.choice='ABC\ncde' > > > In [69]: c.save() > > > In [70]: Choice.objects.filter(choice__search='abc') > > Out[70]: [] > > That's not what I would have expected to see. me neither. > Have a look at the SQL > that Django is generating and see if there are any clues there. To do > that, make sure you have DEBUG=True in your settings file (which you > will have by default) and then do this: > > from django.db import connection > connection.query[-1]['sql'] nothing strange in the SQL I guess. In [16]: Choice.objects.filter(choice__search='ABC') Out[16]: [] In [17]: Choice.objects.filter(choice__search='efgh') Out[17]: [ABC efgh] In[18]: connection.queries[-2]['sql'] Out[18]: 'SELECT `polls_choice`.`id`,`polls_choice`.`poll_id`,`polls_choice`.`choice`,`polls_choice`.`votes` FROM `polls_choice` WHERE (MATCH (`polls_choice`.`choice`) AGAINST (ABC IN BOOLEAN MODE))' In [19]: connection.queries[-1]['sql'] Out[19]: 'SELECT `polls_choice`.`id`,`polls_choice`.`poll_id`,`polls_choice`.`choice`,`polls_choice`.`votes` FROM `polls_choice` WHERE (MATCH (`polls_choice`.`choice`) AGAINST (efgh IN BOOLEAN MODE))' -abe > > (from the interactive prompt). The connection.query object is a list of > all the SQL queries from the session -- or a single request if you are > using it in webserver mode. > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: __search works in mysterious ways.
On 3/19/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > That's not what I would have expected to see. Have a look at the SQL > that Django is generating and see if there are any clues there. To do > that, make sure you have DEBUG=True in your settings file (which you > will have by default) and then do this: That's actually the correct behavior on MySQL -- it defaults to ignoring words of less than four characters in full-text searches (it also ignores "stop words"). These are configurable in MySQL via the 'ft_min_word_len' and 'ft_stopword_file' options. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: __search works in mysterious ways.
On Mon, 2007-03-19 at 14:09 +, abe wrote: > I'm getting unexpected (missing) results from the __search field > lookup > it looks like it can only finds whole words, but only if they're > larger than > 3 chars. is this correct? and is it supposed to work like this? > > > In [65]: c.choice='ABC123\ncde456' > > In [66]: c.save() > > In [67]: Choice.objects.filter(choice__search='abc123') > Out[67]: > [ABC123 > cde456] > > In [68]: c.choice='ABC\ncde' > > In [69]: c.save() > > In [70]: Choice.objects.filter(choice__search='abc') > Out[70]: [] That's not what I would have expected to see. Have a look at the SQL that Django is generating and see if there are any clues there. To do that, make sure you have DEBUG=True in your settings file (which you will have by default) and then do this: from django.db import connection connection.query[-1]['sql'] (from the interactive prompt). The connection.query object is a list of all the SQL queries from the session -- or a single request if you are using it in webserver mode. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
__search works in mysterious ways.
I'm getting unexpected (missing) results from the __search field lookup it looks like it can only finds whole words, but only if they're larger than 3 chars. is this correct? and is it supposed to work like this? In [65]: c.choice='ABC123\ncde456' In [66]: c.save() In [67]: Choice.objects.filter(choice__search='abc123') Out[67]: [ABC123 cde456] In [68]: c.choice='ABC\ncde' In [69]: c.save() In [70]: Choice.objects.filter(choice__search='abc') Out[70]: [] abe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---