Hierarchy of geography

I am trying to figure out a way to implement faceting with hierarchies in solr and cannot figure out how to do this in my situation. I read several articles on hierarchy execution in solr along with the solutions in patch 64 and 792. The main problem that I am facing is that I have objects that can belong to several branches of the hierarchy. The current form of my data is a user document with MVAs for the country, state and city.

Take, for example, a geographical hierarchy so that people can list their services to the level of the city. A person can serve the entire Alabama, but only some cities in Georgia. Now the number of lights at the state level counts individuals serving the area, which is 1 for Alabama and 1 for Georgia, and when expanded to the city level, it has an account for each city (in other words, the amount of the city’s calculations will not necessarily be equal to the state account, since calculations are not mutually exclusive). A.

USA (1)
Georgia (1)
Atlanta (1)
Columbus (0)
Athens (0)
Alabama (1)
Mobile (1)
Birmingham (1)
Huntsville (1)

, , - , , , , , , . solr-64 , , US/Alabama/Mobile/ US/Georgia/Atlanta/ . , .

?

+3
4

. ( !)

: , .

. :

  • , "". ( , ).
  • . , , node.
  • '-1'
  • , ? . .

    ala <level>_category. . facet.prefix=<level>_

  • ala fq=category:"<level>_categoryId"
  • , , . 2 2 + 1 = 3 : facet.prefix = 3 _
  • , :

    Q: ?

    A: , , Solr, . , , . Solr.

+2

, , , .

group-on SOLR, collapsing (http://wiki.apache.org/solr/FieldCollapsing).

, bobo-browse. , compositeFacetHandlers http://code.google.com/p/bobo-browse/wiki/CompositeFacetHandlers. bobo-browse SOLR (http://code.google.com/p/bobo-browse/wiki/SolrIntegration)

+1

Assuming your documents in the index are one service ....

For the city, create a field that is a state connected to the city using some kind of delimiter. This field does not have to be displayed to the user, it can be added to the field that you store, but do not index this name at this time.

For example, you might have a city_facet field with values:

  • Ohio - Miami
  • Florida - Miami

You will probably want to choose a separator that will be more secure. I believe a hyphen can be a potential conflict.

0
source

Source: https://habr.com/ru/post/1784836/


All Articles