Add custom facets and advanced search filters
Before you begin: To add custom facets
and advances search filters:
- Define a single catalog
class (
part_catalog
in the example below).
- Push the meta
catalog with the catalog class as value
(part_catalog ). This can be done through a consolidation rule
or directly by the connector.
- All metas defined in
the mapping file will be available for all indexed documents with the same
catalog class (no need to refine on the catalog facet as there is only one
catalog class).
- As all documents are
in the same catalog class, the UI will always display all the custom attributes
in facets and advanced search.
- All metas will be
displayed in the preview, table and compare pages.
- See
To implement the catalog mapping file
Sample csv file
The
elasticDataModel.csv details to add custom facets and
search filters.
Context:
Catalog class
|
Meta name
|
Data type
|
Display type
|
Full-text search
|
Facet category
|
Unit
|
Extra SAPI params
|
part_catalog
|
erp_supplier
|
Alphanum
|
Facet
|
x
|
who
|
|
|
part_catalog
|
erp_avail_quantity
|
Decimal
|
Search
|
|
|
|
|
part_catalog
|
erp_price
|
Decimal
|
Search
|
|
what
|
|
|
Add custom metas to the Preview page
User case to add custom metas to the preview, table and compare
pages.
Before you begin: You must do the
following:
Sample csv file
The
elasticDataModel.csv details to display metas only.
Catalog class
|
Meta name
|
Data type
|
Display type
|
Prefix
handler
|
Full-text search
|
Facet category
|
Unit
|
Extra SAPI params
|
part_catalog
|
erp_supplier
|
Alphanum
|
Display
|
|
x
|
who
|
|
|
part_catalog
|
erp_avail_quantity
|
Decimal
|
Display
|
|
|
|
|
|
part_catalog
|
erp_price
|
Decimal
|
Search
|
price
|
|
what
|
|
|
Add a catalog facet
To create a new catalog facet using the elastic data model
that displays in
Specific classes, for example, a catalog
structure.
Context:
- Push the meta
catalog with the catalog class value, for example,
Battery Products/Packs .
- All metas defined in
the mapping file will be available for all indexed documents with the same
catalog class.
- All the metas will
be displayed in the preview, table and compare pages. See
Example - Catalog attributes in the preview page
- But, as there are
several catalog classes, the UI will
not show custom attributes in facets and
advanced search if the current results list mixes hits from more than one
catalog class
- To display the custom
attributes in facets and advanced search, the result list should only show a
single catalog class, which is usually achieved by either:
- Performing the
search, for example,
packs; specific facets such as
manufacturer would show when the result
list contains only single class
Battery Products / Packs. See the
manufacturer meta defined in the sample csv
file below.
- Refining on the
specific catalog class, for example, refining on
Battery Products/Batteries Non-Rechargeable
(Primary)
would show specific facets for this catalog class,
such as
battery_cell_size.
To set up a catalog structure
Sample csv file
The
elasticDataModel.csv details for setting up a
catalog structure.
- Since there are
several catalog classes, the UI will not show custom attributes in facets and
advanced search if the current results list mixes hits from more than one
catalog class
- To display the
custom attributes in facets and advanced search, the result list should only
show a single catalog class, which is usually achieved by either:
- Narrowing the
search
- Refining on the
specific catalog class (for example:
Battery Products/Packs )
Catalog class
|
Meta name
|
Data type
|
Display type
|
Prefix
handler
|
Full-text search
|
Facet cat.
|
Unit
|
Extra SAPI params
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
manufacturer
|
Alphanum
|
Facet
|
|
x
|
who
|
|
sort=alphanum
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
series
|
Alphanum
|
Facet
|
|
x
|
where
|
|
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
battery_cell_chemsitry
|
Alphanum
|
Facet
|
|
|
what
|
|
sort=alphanum&refinement_policy=
disjunctive
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
battery_cell_size
|
Alphanum
|
Facet
|
|
|
what
|
|
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
voltage_rated
|
Decimal
|
Search
|
|
|
what
|
voltage
|
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
termination_style
|
Alphanum
|
Facet
|
|
|
what
|
|
|
Battery Products/Batteries Non-Rechargeable
(Primary)
|
life_duration
|
Decimal
|
Search
|
|
|
when
|
time
|
|
Battery Products/Packs
|
manufacturer
|
Alphanum
|
Facet
|
|
x
|
who
|
|
|
Battery Products/Packs
|
quantity_available
|
Decimal
|
Search
|
|
|
|
|
|
Battery Products/Packs
|
number_of_cells
|
Decimal
|
Search
|
ncells
|
|
|
|
sort=alphanum
|
Battery Products/Packs
|
voltage_rated
|
Decimal
|
Search
|
vmin
|
|
|
voltage
|
|
Battery Products/Packs
|
series
|
Alphanum
|
Facet
|
|
x
|
where
|
|
|
Example - new Catalog facet
Example - Catalog attributes in the preview page
Manage i18n
Like other facets and metas, you can use I18n for your elastic
properties.
You can implement different screens for different user
roles, with differentiated attribute display. For more details, see
Customizing the UI in the
OnePart Customization Guide.
- For fields with Facet
Display type, keys looks-like:
facet_Top/classproperties/edm_alph_f/edm_alph_f_META_NAME/VALUE
, as you can see, this key is composed by a constant part
facet_Top/classproperties/edm_alph_f/edm_alph_f_
, your meta name, and the value. Let's details theses parts:
- Constant part:
- The
alph part is only for fields with a
Alphanum Data type,
replace it by
deci for
Decimal, replace it by
date for
Date.
- The
f part is only for fields with
Facet Display type
- Meta name: The meta
name declared in the EDM config file
- Value: The value of
the meta whit spaces replaced by "_". If you ignore the value part, you
translate the facet title.
- For other fields, keys
looks-like:
- For the titles:
meta_edm_alph_d_META_NAME , as you can see, this
key is composed by a constant part
meta_edm_alph_d_ and your meta name. Let's
details these parts:
- Constant part:
- The
alph part is only for fields with
a
Alphanum Data
type, replace it by
deci for
Decimal, replace it by
date for
Date.
- The
d part is only for fields with
Display Display type, replace it
by s for
Search.
- Meta name: The
meta name declared in the EDM config file.
- For the values: There
is no translation available, when you configure the meta as a decimal with
unit, we will format the provided value, same for meta configured as a date.
Otherwise we will highlight values.
You manage the i18n files as follows.
-
Edit
onepart_X.properties found in
DATADIR/webapps/360-mashup-ui/WEB-INF/i18n/ .
-
Add a line for the label you wish to edit, using the following
format:
- for facets:
facet_Top/classproperties/edm_[alph,deci,date]_f/edm_[alph,deci,date]_f_META-NAME
- for metas:
meta_edm_[alph,deci,date]_[d,f,s]_META-NAME
-
For example: add
my_awesome_price and
my_awesome_source in the
elasticdatamodel.csv with the following
lines:
,"my_awesome_price","Decimal","Search",,,
"what","price(€,after)",,
,"my_awesome_source","Alphanum","Facet",,,"where",,,
-
In the
onepart.properties file, you need to add this line
to display it as "Unbeatable price":
meta_edm_deci_s_my_awesome_price=Unbeatable
price
facet_Top/classproperties/edm_alph_f/edm_alph_f_my_awesome_source=Awesome
source
facet_Top/classproperties/edm_alph_f/edm_alph_f_my_awesome_source/source_1=French
source
-
Restart your search-server and refresh the page.
The new label will be displayed
|