← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 736493] [NEW] [trunk][improvement]product.product name_search function

 

Public bug reported:

Hi,

This isn't a bug but something that annoys me enough to report from a
usability standpoint.  When searching products by name you need to know
the exact string.  Imagine you have 5000 products that contain red, and
2000 products that contain car but only 50 that contain both the words
red and car and only one with the string 'red car'.  The current
name_search function tries to match the whole string passed, which means
you can't ask for all products containing both red and car, just those
containing specifically 'red car' .

I made a simple 2 line modification to name_search which splits the
search string, and matches on the words in the search rather than the
entire string.  In a database of 400,000 products it is now easy for my
users to find parts. I'd like it considered for updating in trunk as
fixing a usability bug.  Change line 566 from

                 ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
to
                args2 = [('name', operator, x) for x in str.split(name)]
                ids += self.search(cr, user, args + args2, limit=limit, context=context)

Thanks for reading

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/736493

Title:
  [trunk][improvement]product.product name_search function

Status in OpenERP Modules (addons):
  New

Bug description:
  Hi,

  This isn't a bug but something that annoys me enough to report from a
  usability standpoint.  When searching products by name you need to
  know the exact string.  Imagine you have 5000 products that contain
  red, and 2000 products that contain car but only 50 that contain both
  the words red and car and only one with the string 'red car'.  The
  current name_search function tries to match the whole string passed,
  which means you can't ask for all products containing both red and
  car, just those containing specifically 'red car' .

  I made a simple 2 line modification to name_search which splits the
  search string, and matches on the words in the search rather than the
  entire string.  In a database of 400,000 products it is now easy for
  my users to find parts. I'd like it considered for updating in trunk
  as fixing a usability bug.  Change line 566 from

                   ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
  to
                  args2 = [('name', operator, x) for x in str.split(name)]
                  ids += self.search(cr, user, args + args2, limit=limit, context=context)

  Thanks for reading



Follow ups

References