CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Feature #30200

Support for range facets using jQuery ui sliders

Added by Michiel Roos over 1 year ago. Updated about 1 year ago.

Status:Closed Start date:2011-09-22
Priority:Should have Due date:
Assignee:Ingo Renner % Done:

100%

Category:Frontend Plugins
Target version:2.0
TYPO3 Version: Has patch:
PHP Version: Tags:
Votes: 0

Description

Here is a patch that enables support for range facets using jQuery sliders.

This is usefull if you use index queues to index records with numeric values (think product dimensions or price).

1. Add fields to your solr schema file:

      <field name="height" type="sint" indexed="true" stored="true" />

Take note to use the sint, slong, sfloat and sdouble for numeric fields. Otherwise you will not be able to do range queries on the field

2. Add TypoScript configuration to index and facet the field

 plugin.tx_solr {
   search {
     faceting {
       facets {
         height
           label = Height
           field = height
           type = range
           range {
             gap = 1
             start = 0
             end = 100
           }
           renderer = tx_solr_facet_RangeFacetRenderer
           filterParser = tx_solr_query_filterparser_Range 
           renderingInstruction = TEXT
           renderingInstruction {
             field = optionValue
             noTrimWrap = |<img src="fileadmin/Images/Solr/Icons/height.png" title="height" /> ||
           }
         }
       }
     }
   }
   index.queue {
     pages = 1
     tx_someextension_domain_model_product = 0
     tx_someextension_domain_model_product {
       table = tx_someextension_domain_model_product
       fields {
         type = TEXT
         type.value = product
         stackable = COA
         stackable {
           5 = TEXT
           5.value = yes
           5.if.isTrue.field = stackable
           10 = TEXT
           10.value = no
           10.if.isFalse.field = stackable
         }
         height = COA
         height {
           5 = TEXT
           5.field = height
           5.if.isTrue.field = height
         }
       }
     }
   }
   _LOCAL_LANG {
     default {
       sorting_height = hoogte
     }
     en {
       sorting_height = height
     }
     nl < .default
  }
 }

3. Re-index
4. Profit!

There are three new files:
  • classes/facet/class.tx_solr_facet_rangefacetrenderer.php
  • resources/javascript/jquery-ui-1.8.16.custom.min.js
  • resources/javascript/pi_results/range_facet.js

The jquery-ui includes the needed slider widget.

range_facet.diff (7.8 kB) Michiel Roos, 2011-09-22 12:37

jquery-ui-1.8.16.custom.min.js (86.5 kB) Michiel Roos, 2011-09-22 12:37

range_facet.js (540 Bytes) Michiel Roos, 2011-09-22 12:37

class.tx_solr_facet_rangefacetrenderer.php (3.9 kB) Michiel Roos, 2011-09-22 12:37

Screen_Shot_2011-09-22_at_12.36.39_PM.png (170.6 kB) Michiel Roos, 2011-09-22 12:37

range_facet-v2.diff (8.7 kB) Michiel Roos, 2011-09-22 14:14

History

Updated by Ingo Renner over 1 year ago

  • Target version set to 2.0

Updated by Michiel Roos over 1 year ago

Hide the showMore links for range facets.

Updated by Olivier Dobberkau over 1 year ago

  • Status changed from New to Needs Feedback
  • Assignee set to Ingo Renner

Ingo, can you evaluate this patch? Thanks!

Updated by Ingo Renner over 1 year ago

  • Category changed from Indexing to Frontend Plugins

Updated by Ingo Renner over 1 year ago

  • Status changed from Needs Feedback to Accepted
  • Assignee deleted (Ingo Renner)

Updated by Ingo Renner over 1 year ago

  • Status changed from Accepted to Under Review
  • Assignee set to Ingo Renner

Updated by Ingo Renner over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Added in dkd-EAP r 91036 Thanks a lot Michiel, great feature!

Updated by Ingo Renner over 1 year ago

short documentation snippet on how to use:

plugin.tx_solr.search.faceting.facets {

    myNumericRangeFacet {
        label = Numeric Range
        field = myNumericField_sIntS

        type = numericRange
        numericRange {
            start = 0
            end = 100
            gap = 1
        }
    }

}

Updated by Ingo Renner about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF