我的solr json响应如下,
{
"stateOrProvinceId":"TN",
"entityType":"hotelInfo",
"chainCode":"SM",
"marketerName":"InnLink",
"propertyId":"4380",
"marketerId":"INNLINK",
"propertyStatus":"Active",
"chainName":"Innlink",
"propertyName":"Value Place Memphis NE",
"countryCode":"US"},
{
"entityType":"hotelInfo",
"chainCode":"GT",
"marketerName":"Golden Tulip",
"propertyId":"69170",
"marketerId":"GOLDENT",
"propertyStatus":"Active",
"chainName":"Golden Tulip Hotels",
"propertyName":"Tulip Inn Sunny Hill",
"countryCode":"RO"},
{
"stateOrProvinceId":"TN",
"entityType":"hotelInfo",
"chainCode":"BW",
"marketerName":"Best Western",
"propertyId":"85336",
"marketerId":"BESTWEST",
"propertyStatus":"Active",
"chainName":"Best Western Intl",
"propertyName":"BEST WESTERN Brentwood",
"countryCode":"US"},
{
"entityType":"amenitiesInfo",
"propertyId":"69170",
"amenitiesInfoAttrId":"AC"},
我们正在搜索我们使用以下布尔查询的特定属性id
BooleanQuery booleanQuery = new BooleanQuery();
booleanQuery.add(new TermQuery(new Term("propertyId", pid)), BooleanClause.Occur.SHOULD);
正在给出以下回复,
{
"entityType":"hotelInfo",
"chainCode":"GT",
"marketerName":"Golden Tulip",
"propertyId":"69170",
"marketerId":"GOLDENT",
"propertyStatus":"Active",
"chainName":"Golden Tulip Hotels",
"propertyName":"Tulip Inn Sunny Hill",
"countryCode":"RO"},
{
"entityType":"amenitiesInfo",
"propertyId":"69170",
"amenitiesInfoAttrId":"AC"},
现在我需要一个查询,只能获得hotelInfo以及amenitiesInfo。
提前感谢您的帮助。 拉加
答案 0 :(得分:0)
我不知道我是否正确理解,根据我的理解,您希望根据以下两个标准构建查询: pid 和 entityType ,如果你想这样做,你应该在 entityType 上的BooleanQuery中添加其他TermQuery,你应该尝试类似以下内容:
let map2 f =
function
| OptionalValue.Present(a'), OptionalValue.Present(b') -> Some (f a' b')
| _ -> None
let map2series f series1 series2 =
series2
|> Series.zip series1
|> Series.mapAll(fun _ -> Option.bind(map2 f))