Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-14068

Filter definition must be an array in ezfind fetch, although documentation seems to allow string definition

    XMLWordPrintable

Details

    Description

      The syntax described in documentation (the version thath was aimed for eZ find 1.1 however) for filtering on ezfind fetch doesn't seem to be valid any more in eZ find 2.0.

      The document describes on page 12 that filter option may be a string or an array:

      A filter is specified by <class_identifier>/<class_attribute>[/<sub_structure]:<value>. The
      filter option may be a string or list of strings.

      However, giving a string as done in the example just doesn't work:

      Example:
      fetch( ezfind, search,
      hash( query, 'eZ Systems',
      filter, 'car/in_stock:1' ) )

      This will only work if filter definition is given in an array. Indeed, it seems that it comes from the solr query builder, that expects for an array on his treatment (in method buildsearch). The attached patch can get around this case and allows to use a string filter definition.

      Steps to reproduce
      • In a search template (for an example advancedsearch.tpl), define your search to use ezfind fetch with a string-typed filter:
            {set $search=fetch(ezfind,search,
                               hash(
                               	query,$search_text,
                               	filter,'<class&gt;/<attribute>:<filter_value>'
                               ))}
      • This should end as a non working filter, you will have to use a filter like
            {set $search=fetch(ezfind,search,
                               hash(
                               	query,$search_text,
                               	filter,array('<class&gt;/<attribute>:<filter_value>')
                               ))}

        to make it work, although the documentation seemed to allow the string syntax

      Attachments

        Activity

          People

            pborgerm pborgerm
            alexandre.nion alexandre.nion
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: