Most Powerful Open Source ERP

Quick Search Area

How the Quick Search Area works.
  • Last Update:2016-05-16
  • Version:001
  • Language:en

How the Quick Search Area works.

Table of Contents

Quick Search

The quick search button on the top right button of ERP5 is intended to provide some clever results with as little information as possible. It is used to initiate a query.

Examples

  User input: P-ERP5
  Result: the ERP5 project, followed by documents followed which contain the P-ERP5 ngram 

  User input: 34834
  Result: the invoice No 34834, followed by documents which contain the 34834 ngram

Implementation

The top right search field (both in KM and ERP5) is called something like new_quick_search_text to notify the fact that the information which is entered is only supposed to be used to initiate a new query.

The query value (ex. P-ERP5) is passed to the catalog under the keywokd quick_search_text, which is a scriptable key. A script is then invoked to process the value:

  # pseudo-code
  if isAdvanced(value):
    # the text which was provided contains
    # is not a simple valye
    return Query(SearchableText=value)

  return ComplexQuery(Query(title=value),
                      Query(reference=value),
                      Query(source_reference=value),
                      Query(destination_reference=value),
                      Query(SearchableText=value),
                      operator="OR")

Task: review naming and implementation

Implementation Future

Hopefully, we will be able to create a kind of order based on weights in catalog which can be used to sort results based on their rank.

  # pseudo-code
  if isAdvanced(value):
    # the text which was provided is not a simple value
    # and contains predicats such as portal_type:
    return Query(SearchableText=value)

  return ComplexQuery(Query(title=value, key='RawKey', weight=1),
                      Query(reference=value, key='RawKey', weight=1),
                      Query(source_reference=value, key='RawKey', weight=1),
                      Query(destination_reference=value, key='RawKey', weight=1),
                      Query(advanced_search_text=value, key='RawKey', weight=1),
                      Query(title=value, key='KeywordKey', weight=0.5),
                      Query(SearchableText=value),
                      operator="OR")

Task: make sure unions are possible and that they can take into account the full text search ranking (MATCH) in combination with other values

Customisation

TScriptable keys are very useful for site customisation of the top right search box. Some sites which are always searching for invoices based their reference.

They may prefer the following:

  # pseudo-code
  if isAdvanced(value):
    # the text which was provided is not a simple value
    # and contains predicats such as portal_type:
    return Query(SearchableText=value)

  return ComplexQuery(ComplexQuery(
                       Query(portal_type='Invoice'),
                       Query(reference=value),
                       operator="AND")
                      )
                      Query(SearchableText=value),
                      operator="OR")

Advanced Search Key

The advanced search key is probably no longer useful since the catalog itself implements a search grammar. A careful review of SQLCatalog_makeAdvancedSearchQuery is required though to make sure that no feature is lost.

Listbox SearchableText

Each listbox has an optional SearchableText on top and bottom. This SearchableText field is not related to scriptable keys.

Search Area

Default Search Domains

The default search domains for quick search (in the access tabs of ERP5, in KM) should be configured using portal_domains and a combination of static and dynamic domains. The choice of domains (or or many) is a user preference.

Task: remove hardcoding of search domains

Additional Search Domains

In ERP5 KM sites, the search_area Web Section is configurable and can be used to extend the default search predicates on a site per site level (ex. Staff News, Product News, etc.) by combining selected portal types and categories.

Task: extend domain lookup

Related Articles