Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Facet in Solr

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Solr how to use Facet, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

The basic function of facet is to classify items in search results.

1.facet usage

Facet.field: specify the fields to classify

Facet=on or facet=true indicates that the function is enabled.

Facet.prefix represents the field prefix

Facet.limit indicates the number of records returned

Facet.offict indicates that it starts with several articles and is mainly used for paging.

Facet.query can define queries at will

Note: the index index of the field used for facet must be set to true

2..facet.field

Here we look up the categories of products that contain white in the product name, and know how many records there are in each category.

If you put the query condition Q = white facet.field=CategoryName, you will get the following result

You can see that there are two commodity names in the category T-shirt, including white.

There is one item in the classified pants, including white.

3. Make segmented query by price

The items in the search results can be segmented by price range. Let's take a look at how to segment, open the solrconfig.xml configuration, and find the following nodes

Explicit

ten

Text

Str name= "facet" > on

Price

0

5000

one thousand

The field in the facet.range node that is segmented by range is Price

F.Price.facet.range.start indicates that the starting value is 0

F.Price.facet.range.end indicates a maximum value of 5000

F.Price.facet.range.gap indicates that segments are performed at intervals of 1000 each time.

Finally, the result we see is as follows

0

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report