Package org.alfresco.solr.schema.highlight


package org.alfresco.solr.schema.highlight
This package contains a custom field type (and dependent component) which is supposed to be used only on fields that
  • are marked as stored and not indexed (indexed = false, stored = true)
  • are used in highlighting requests (the reason why this package belongs to a "highlight" namespace)
The underlying reason of this customisation is mainly related with the custom highlighter used in Alfresco Search Services: highlight fields needs have the following requirements:
  • they have to be stored
  • they don't have to be indexed but they must have a TextField (or a subclass) as type, because they must provide an index time Analyzer (yes, even if indexed is set to false) which will be used for analysing the stored content and extract the highlighting snippets.
The field type purpose is actually to define a custom analyzer which is able to detect the proper localised analyzer at runtime, depending on the locale marker prefix put on the stored content. For example,
  • a field "title" with the following content: "enthis is an english title" will be highlighted using an english analyzer (specifically the index analyzer of the "highlighted_text_en" field type, or the index analyzer of the "text_en" field type in case the previous one is missing)
  • a field "title" with the following content: "itQuesto sarebbe un titolo" will be highlighted using an italian analyzer (specifically the index analyzer of the "highlighted_text_it" field type, or the index analyzer of the "text_it" field type in case the previous one is missing)
  • a field "title" with the following content: "This is a title without any locale marker" will be highlighted using the analyzer of the general text field "text___".
  • a field "title" with the following content: "unknown_localeThis is a title without an unknown locale marker" will be highlighted using the analyzer of the general text field "text___".
  • Classes
    Class
    Description
    A custom Analyzer type, aware about the Solr IndexSchema, which delegates the processing to a custom TokenStream.
    A custom TextField type which is able to set at runtime the analyzer to be used.
    A TokenStream decorator which determines dynamically the field type and the analyzer used for executing the analysis of an input text.