嵌套构面搜索

时间:2014-02-18 06:55:10

标签: solr

我在Solr中有以下文件:

(1) { date:"2013-01-01", person:"John",  activity:"swimming" }  // <-- watch out date/year
(2) { date:"2014-01-02", person:"John",  activity:"cycling"  }
(3) { date:"2014-01-03", person:"John",  activity:"jogging"  }
(4) { date:"2014-01-01", person:"Paul",  activity:"swimming" }
(5) { date:"2014-01-02", person:"Paul",  activity:"cycling"  }
(6) { date:"2014-01-03", person:"Paul",  activity:"jogging"  }
(7) { date:"2014-01-01", person:"Ringo", activity:"swimming" }
(8) { date:"2014-01-02", person:"Ringo", activity:"cycling"  }
(9) { date:"2014-01-03", person:"Ringo", activity:"climbing" }  // <-- watch out activity

将所有字段设为indexedstored

现在,我想查找所有swimming AND cyclingNOT jogging(全部在2014内)的人。当然,正确的答案应该是Ringo。我认为解决方案将是一个嵌套的方面搜索,但我不确定,我不知道如何。

1 个答案:

答案 0 :(得分:0)

编辑:好的,我现在明白了...'游泳和骑自行车'你的意思是Lucene AND。当然,这是无效的。

然后,怎么样,你可以查询activity:(swimming) AND date:[2014-01-01T00:00:00.000Z TO 2014-12-31T23:59:59.999Z],并使用以下方面: facet=on&facet.query=activity:cycling&facet.query=activity:jogging只保留循环方面的值,但不要保持在慢跑方面。

需要一些客户端代码但应该有用吗?