简体   繁体   English

通过在多值字段中排名提高结果

[英]Boost results by position in multi-valued field

I have a hierarchical structure like Client->Project->Subproject (it can have n levels). 我有一个类似Client-> Project-> Subproject的层次结构(它可以具有n个级别)。 For each leaf (Subproject) I keep a multi-valued ordered field of parents up to the root, so the search can match on both name and parent names. 对于每个叶子(子项目),我会保留一个多值有序的父级字段,直到根为止,以便搜索可以在名称和父级名称上都匹配。

When someone searches for "pro" I would like the results to show up in the following order: subprojects first, then projects, then clients, as below: 当有人搜索“ pro”时,我希望结果按以下顺序显示:首先是子项目,然后是项目,然后是客户端,如下所示:

<doc>
  <str name="name">Sub**pro**ject1</name>
  <arr name="parentNames">
    <str>Project1</str>
    <str>Client1</str>
  </arr>
</doc>
<doc>
  <str name="name">Subprj2</name>
  <arr name="parentNames">
    <str>**Pro**ject1</str>
    <str>Client1</str>
  </arr>
</doc>
<doc>
  <str name="name">Subprj3</name>
  <arr name="parentNames">
    <str>Prj2</str>
    <str>Client **Pro**1</str>
  </arr>
</doc>

Boosting the name is simple, but boosting the parentNames applies equally to all entries in the multi-valued field, so entries 2 and 3 will not appear in the order I wanted. 提升名称很简单,但是提升parentNames同样适用于多值字段中的所有条目,因此条目2和3不会以我想要的顺序出现。

I assume there is no straightforward way to achieve this, but which way would you go? 我认为没有简单的方法可以实现这一目标,但是您会走哪条路呢? Custom search component or maybe somehow boosting the values at index time? 自定义搜索组件还是以某种方式提高索引时的值?

为了回答我自己的问题,这篇文章似乎可以解决这个问题: http : //architects.dzone.com/articles/searching-hierarchical-fields

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM