Working With Any Dataset

This section dives deeper into the supported Panl field configurations.

The drivers behind the Panl configuration options are the Solr fieldType and whether it is configured to be a facet or a field.  For example, the variants Solr field in the mechanical pencils Solr managed schema:

# <field "indexed"="true" "stored"="true" "name"="variants" "type"="string"
        "multiValued"="true" />

The type (i.e. the Solr fieldType) of string above is then referenced in the managed schema to

<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

It is the class attribute above (which is included in the mechanical-pencils.panl.properties file as a comment) which then drives the configuration available.  The value of the attribute is then used to lookup the Solr class value from the fieldType element in the managed schema file.  This fieldType is then output to the property file.

# <field "indexed"="true" "stored"="true" "name"="variants" "type"="string"
        "multiValued"="true" />
panl.field.v=variants
panl.name.v=Variants
panl.type.v=solr.StrField

The panl.type.v=solr.StrField is the property value that Panl parses to determine the available configuration options.

Supported Solr Data Types

The following Solr field types are explicitly supported in Panl, and the configuration options that are available are described.

All facets may be hierarchical, and can be sorted by either their count, or their value.

Solr Field Type

Prefix / Suffix

Range

OR

Boolean Value Replace

Date Range

solr.BoolField

YES

NO

NO

YES

NO

solr.DatePointField

NO

NO

NO

NO

YES

solr.DoublePointField

YES

YES

YES

NO

NO

solr.FloatPointField

YES

YES

YES

NO

NO

solr.IntPointField

YES

YES

YES

NO

NO

solr.LongPointField

YES

YES

YES

NO

NO

solr.StrField

YES

NO

YES

NO

NO

solr.TextField

NO

NO

NO

NO

NO

solr.UUIDField

YES

NO

YES

NO

NO


Notes: The solr.TextField above should only be used as a Panl field, not a facet.  If it is configured as a facet, then every indexed word in all of the fields will be included as a facet.


Unsupported/Partially Supported Solr Field Types

Whilst the following fields aren't officially supported by Panl, they can still be returned within the results documents (i.e. configured to be fields).  If they are configured to be facets, then the operation of Panl is undefined, however, they may work, they are just untested.

  • solr.BBoxField
  • solr.BinaryField
  • solr.CollationField
  • solr.CurrencyFieldType
  • solr.DateRangeField
  • solr.ExternalFileField
  • solr.ICUCollationField
  • solr.LatLonPointSpatialField
  • solr.NestPathField
  • solr.PointType
  • solr.PreAnalyzedField
  • solr.RankField
  • solr.RptWithGeometrySpatialField
  • solr.SortableTextField
  • solr.SpatialRecursivePrefixTreeFieldType

IMPORTANT: The Panl generator will not generate any configuration for the above field types, you will have to manually configure them yourself as fields or facets.

Facet and Field Types

Each of the Panl fields can be defined as a Field, or a Facet.  If the Panl field is configured to be a 'Field', then it will be returned with the documents, but no other configuration options are applicable.  If it is configured as a 'Facet' then, depending on the Solr field type, the configuration properties available to Panl will vary.

Fields

Fields are returned with the documents so that they may be rendered to the results page.  They can be sorted on, but they CANNOT be faceted on.  Any Solr field that is stored (i.e. stored="true" in the managed schema) may be a field, additionally any Solr field that is indexed (i.e. indexed="true" in the managed schema) may be set as a facet, or a field.

Multiple <panl_collection_url>.panl.properties files can be defined with separate Panl properties files with different configurations of facets and fields all connecting to a single Solr search collection.

To configure any Solr field as a Panl field, use the panl.field.<lpse_code> property, rather than the panl.facet.<lpse_code> property.

01

02

03

04

# <field "indexed"="true" "stored"="true" "name"="diameter" "type"="pint" ↩
        "multiValued"="false" />

panl.field.d=diameter

panl.name.d=Diameter

panl.type.d=solr.IntPointField

The only other configuration option for a field is the Panl field name - i.e. panl.name.<lpse_code> - which is a 'nicer' display name for the field.

Hints/Recommendations:

  • Generally, fields that contain a lot of text are better configured as a Panl Field, unless you wish to have the words in the text as individual facets (similar to a word cloud).
  • Use fields for any Solr field that you want to be able to sort on, or be returned with the documents.
  • Any facet can be configured to be a field - remember that you may have multiple CaFUPs configured using it as a field or a facet in different places.
  • Any field can be configured to be returned or ignored with different Panl FieldSets.

Regular Facets

If you are going to facet on a Solr field, then the mapped field type should be at least indexed and it is a good idea to have it stored as well, but ensure that the type is not mapped to a Solr field type that is analysed.  Multi valued fields are also good to use as facets as they will allow multiple choices for faceting the results, without the need for an OR facet.

Note: The reason behind not analysing the Solr field is that if the field is also analysed, then the facets that are returned will be broken up into their word forms.


Hints/Recommendations:

  • Regular facets are easy to set up, use, implement, offer prefixes and suffixes, and can be used as a sort order and do not have to be returned in the result documents.
  • If they are multi-valued, the end user will be able to select more than one.
  • They can be configured to be an OR facet if they are single valued, which will allow users to select more than one value.

BOOLEAN Facets

BOOLEAN facets may only have one of two values, namely true or false and can have those values replaced by Panl from a more SEO friendly string to their underlying values.

The only Solr fieldTypes that allow true/false value replacement is the solr.BoolField and these replacements can be set with the panl.bool.<lpse_code>.true and panl.bool.<lpse_code>.false properties.

You may still assign a prefix and suffix to the BOOLEAN facet.  As an example, the disassemble Solr field from the mechanical pencils configuration has the following properties in the mechanical pencils configuration:

01

02

03

04

05

06

07

# <field "indexed"="true" "stored"="true" "name"="disassemble" "type"="boolean" ↩
        "multiValued"="false" />

panl.facet.D=disassemble

panl.name.D=Disassemble

panl.type.D=solr.BoolField

panl.bool.D.true=able to be

panl.bool.D.false=cannot be

panl.suffix.D=\ disassembled


Hints/Recommendations:

  • For BOOLEAN facets, use the true and false value replacements where it makes sense.  
  • Not all BOOLEAN facets have to have the value replacement, if this field is not used often
  • If you want to shorten the URL path part further, replace the true/false values with single characters - e.g. 1/0 or y/n
  • BOOLEAN replacement values are case-sensitive

RANGE Facets

RANGE facets allow the end user to filter the results of the facet by a range of values and have the most Panl configuration options available.  Whilst ranges are available on String types of data  in Solr, the main usage in Panl is with integer or floating point numbers.

RANGE facets will also return the individual values for each of the ranges which do not have to be rendered to the page.

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

# <field "indexed"="true" "stored"="true" "name"="weight" "type"="pint" ↩
        "multiValued"="false" />

panl.facet.w=weight

panl.name.w=Weight

panl.type.w=solr.IntPointField

panl.suffix.w=\ grams

panl.range.facet.w=true

panl.range.min.w=10

panl.range.max.w=50

panl.range.prefix.w=weighing from

panl.range.infix.w=\ to

panl.range.suffix.w=\ grams

panl.range.min.value.w=from light

panl.range.max.value.w=heavy pencils

panl.range.min.wildcard.w=true

panl.range.max.wildcard.w=true



Hints/Recommendations:

  • Use sparingly, and where it makes sense, ranges can filter the result set easily down to zero results returned if the range of values in the documents falls slightly outside.
  • If there is a large number of disparate values then a range facet may be useful, if there are only a few values, then a regular facet may suffice.
  • Derived fields and ranges can also be another option for a range facet, with the dataset being used to generate static ranges and then stored in the Solr field.

DATE Range Facets

Solr stores a date field (of fieldType DatePointField) and stores the date as String representations expressed in Coordinated Universal Time (UTC - i.e. YYYY-MM-DDThh:mm:ssZ). An example value: 1972-05-20T17:33:18Z.

This means that when you choose this for a facet, each of the fields will be returned to the exact second without being able to be rolled up to a day, month, or year.   This leads to a very long list of facet values, one for each of the returned result documents.  Consequently Panl will not return any facetting information from Solr, however it will add information for the configured date range to the returned JSON object.  This will allow the date range to be implemented on the front end.

01

02

03

04

05

06

07

08

09

10

# <field "indexed"="true" "stored"="true" "name"="solr_date" "type"="pdate" ↩
        "multiValued"="false" />

panl.facet.S=solr_date

panl.name.S=Solr Date

panl.type.S=solr.DatePointField

panl.date.S.previous=previous

panl.date.S.next=next

panl.date.S.years=\ years

panl.date.S.months=\ months

panl.date.S.days=\ days

panl.date.S.hours=\ hours


Both the
panl.date.<lpse_code>.previous and panl.date.<lpse_code>.next properties must be set for the DATE Range facet to be active, however they do not have to be implemented on the front-end.

IMPORTANT: Panl will __NOT__ request faceting on any Date field types which means that they will not be returned in the base Solr response object, however they can be returned in the field list of Solr document results.

Date field types that are defined as facets within the properties file can be used to return RANGE facet values from NOW +/- a specific period.


Hints/Recommendations:

  • If there is a Solr fieldType of then solr.DatePointField this will ALWAYS be configured to be a DATE Range facet
  • If you want to have a date range of an arbitrary timeframe  - say 3 months to 6 months ago, then you will need to derive a field based on that value and then set a range for that field.  For example, if you wanted to range on months then derive a field of month and set it to year * 12 + month - i.e. 1 would be January, year 0 whilst 24295 is July 2024.

OR Facets

OR facets usually allow an end user to increase the number of results by choosing a single facet value OR another facet value for the same facets.  If there are other facets available for this selection within this facet, then they will appear.

01

02

03

04

05

# <field "indexed"="true" "stored"="true" "name"="brand" "type"="string" ↩
        "multiValued"="false" />

panl.facet.b=brand

panl.or.facet.b=true

panl.name.b=Brand

panl.type.b=solr.StrField


OR facets work in conjunction with each other,  if you have multiple OR facets configured for a Panl collection then they work within their specific facet, not across facets.

Example:

If two facets are set as OR facets, for example Manufacturer and Mechanism Type.  Multiple values for either of the two facets can be selected, provided that the Manufacturers that are selected also have documents with the Mechanism Type.

If you were to choose 'BIC' OR 'OHTO' as pencil manufacturers, and 'Click' OR 'None' then the query would of the form:

Select all pencils that are manufactured by BIC or OHTO AND have pencils that are Click or None mechanism types.

Hints/Recommendations:

  • Use OR facets to increase the number of results that are returned.
  • Remember that OR facets only return more facets if there are additional values within the dataset.

Other Facet Options

Hierarchical Facets

Hierarchical facets allow one facet to only appear if another facet (or Panl parameter) has already been selected. In the Book Store example, The book series that an author has published will only appear if an author facet has been selected.

See the panl.when.<lpse_code> section for configuration options.

Hints/Recommendations:

  • Any facet can be made hierarchical.
  • This is useful when you have a lot of facets and not all of them need to appear on the search page, or when you want to guide a user through the search results (for example force the user to select a year, then a month, then a day).

Facet Sorting

By default Solr sorts the facet results by 'count' - i.e. the number of documents that have this facet value.  This can be set to 'index' which will sort on the facet value.

This is a distinct property from the facets or fields that you would want to be able to sort the result documents on.  This sorts a specific facet, not the documents.

For example, in the Book Store Panl configuration the brand facet is configured with panl.facetsort.A=index which will sort the returned facets by their facet values (i.e. index).  Below is an image showing the difference between the facet sorting options.



Image: Images showing the difference between sorting on index (left), and count (right).


See the
panl.facetsort.<lpse_code> section for configuration options.

~ ~ ~ * ~ ~ ~