Nested fields in SOLR

I have a question about the possibility of creating nested fields in solr. Google searches told me something about the band, but I think it's just for the result?

I want to have a structure like this:

  • Category1
    • paragraph 1 (9)
    • paragraph 2 (8)
  • Category2
    • position 3 (6)
  • Category3
    • Item 4 (23)

I tried something like this:

<field name="Category" type="string" indexed="true" stored="true" multiValued="true" required="false"> <field name="MiscellaneousName" type="string" indexed="true" stored="true" multiValued="true" required="false"/> 

But that will not work.

Update: Categories and items must be faceted. The Everey (= facet) element is part of the category. One category can have several or zero fields. Categories and items are stored in the database, and I want to dynamically index them. I only want to search for elements, and categories only text. I am using solr 3.3 with Tomcat 7.

+6
source share
3 answers

Thanks for the update. Rotating faces allow you to do something like:

  • Category1 (17)
    • paragraph 1 (9)
    • paragraph 2 (8)
  • Category2 (6)
    • position 3 (6)
  • Category3 (23)
    • Item 4 (23)

.. but they are only available in Solr 4.0 (trunk). You can, however, simulate these results in a lower Solr (up to 1.4), although it is a bit more complicated and requires two Solr queries instead of one. I wrote a blog post about this - Pivot Faceting (Decision Trees) in Solr 1.4 .

You can save the scheme that you have in the original question - the rotation faceting (real or simulated) works on any arbitrary, different (or the same) fields.

+6
source

Swivel faces are what you need to define a hierarchical hierarchy.
However, you will need to use the trunk assembly to make it work.

If you have problems updating, you can check the option @ http://www.lucidimagination.com/why-lucid/webinars/mastering-power-faceted-search

This is a workaround and you need to manage the data you feed.

 Cattegory1 -> item 1 0//Cattegory1 and 1//Cattegory1//item1 

It works with a combination of -
filter results using fq = category: "0 // Cattegory1"
facet.prefix, which will help you limit the boundaries depending on the level, if you need to limit the results

Http://wiki.apache.org/solr/HierarchicalFaceting may also be useful.

+1
source

Could you make a category just an element field, so, for example, when searching for categories 1 and 1 and 2, the results are returned?

If you have two fields that absolutely must be part of the entity and must be related to each other, the use of fields can help. They were designed for things like a point with x and y values.

I think we need to know more about what exactly you are trying to do in order to offer good ways to handle this in Solr.

0
source

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


All Articles