#solr8
Вопрос:
При поиске дочерних документов в solr 8.1 solr возвращает нежелательный дочерний документ ТОЛЬКО в 1-м результате
Схема Solr 8.1
<!-- Child doc fields -->
<field name="ChildCatalogItemId" type="plong" indexed="true" stored="true"/>
<field name="CatalogPriceSetItemListPriceId" type="plong" indexed="true" stored="true"/>
<field name="CatalogPriceSetId" type="plong" indexed="true" stored="true"/>
<field name="ListPriceEffectiveDate" type="pdate" indexed="true" stored="true"/>
<field name="PriceSetListPrice" type="pfloat" indexed="true" stored="true"/>
<field name="ChildCatalogId" type="plong" indexed="true" stored="true"/>
Поисковый запрос
q = laptop
fl = *,[child parentFilter=laptop childFilter="ListPriceEffectiveDate:[* TO NOW]"]
Вывод Solr в формате XML
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="q">laptop</str>
<str name="fl">*,[child parentFilter=laptop childFilter="ListPriceEffectiveDate:[* TO NOW]"]</str>
<str name="wt">xml</str>
<str name="_">1631084737005</str>
</lst>
</lst>
<result name="response" numFound="11" start="0">
<doc>
<date name="LastUpdatedDate">2021-05-28T10:37:48.553Z</date>
<str name="ProductName">HP Laptop 310</str>
<str name="PreferredSupplier">Hardware Supplier</str>
<str name="CatalogItemNumber">310</str>
<str name="id">76666</str>
<float name="ListPrice">88.0</float>
<long name="CatalogId">195</long>
<str name="CurrencyId">1</str>
<long name="CatalogItemId">76608</long>
<long name="SupplierId">159</long>
<long name="_version_">1710252893041328128</long>
<str name="_root_">76666</str>
<date name="timestamp">2021-09-07T14:17:38.653Z</date>
<doc>
<long name="ChildCatalogId">105</long>
<long name="CatalogPriceSetId">10</long>
<float name="PriceSetListPrice">77.0</float>
<long name="ChildCatalogItemId">75159</long> WRONG ITEM
<date name="ListPriceEffectiveDate">2021-05-28T00:00:00Z</date>
<long name="CatalogPriceSetItemListPriceId">13</long>
<str name="id">13</str>
<str name="_root_">75212</str>
<long name="_version_">1710252892830564352</long>
<str name="ManufacturerName">EMPTY</str>
<str name="ManufacturerNameAssigned">EMPTY</str>
<str name="DiversityClassification">EMPTY</str>
<date name="timestamp">2021-09-07T14:17:38.455Z</date>
</doc>
<doc>
<long name="ChildCatalogId">195</long>
<long name="CatalogPriceSetId">15</long>
<float name="PriceSetListPrice">88.0</float>
<long name="ChildCatalogItemId">76608</long> Correct Document
<date name="ListPriceEffectiveDate">2021-07-06T00:00:00Z</date>
<long name="CatalogPriceSetItemListPriceId">27</long>
<str name="id">27</str>
<str name="_root_">76666</str>
<long name="_version_">1710252893041328128</long>
<str name="ManufacturerName">EMPTY</str>
<str name="ManufacturerNameAssigned">EMPTY</str>
<str name="DiversityClassification">EMPTY</str>
<date name="timestamp">2021-09-07T14:17:38.653Z</date>
</doc>
</doc>
Ответ Json
{
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"q": "laptop",
"fl": "*,[child parentFilter=laptop childFilter="ListPriceEffectiveDate:[* TO NOW]"]",
"wt": "json",
"_": "1631084737005"
}
},
"response": {
"numFound": 11,
"start": 0,
"docs": [
{
"LastUpdatedDate": "2021-05-28T10:37:48.553Z",
"ProductName": "HP Laptop 310",
"CatalogItemNumber": "310",
"id": "76666",
"ListPrice": 88.0,
"CatalogId": 195,
"CatalogItemId": 76608,
"_version_": 1710252893041328128,
"_root_": "76666",
"timestamp": "2021-09-07T14:17:38.653Z",
"_childDocuments_": [
{
"ChildCatalogId": 105,
"CatalogPriceSetId": 10,
"PriceSetListPrice": 77.0,
"ChildCatalogItemId": 75159,
"ListPriceEffectiveDate": "2021-05-28T00:00:00Z",
"CatalogPriceSetItemListPriceId": 13,
"id": "13",
"_root_": "75212",
"_version_": 1710252892830564352,
"ManufacturerName": "EMPTY",
"ManufacturerNameAssigned": "EMPTY",
"DiversityClassification": "EMPTY",
"timestamp": "2021-09-07T14:17:38.455Z"
},
{
"ChildCatalogId": 195,
"CatalogPriceSetId": 15,
"PriceSetListPrice": 88.0,
"ChildCatalogItemId": 76608,
"ListPriceEffectiveDate": "2021-07-06T00:00:00Z",
"CatalogPriceSetItemListPriceId": 27,
"id": "27",
"_root_": "76666",
"_version_": 1710252893041328128,
"ManufacturerName": "EMPTY",
"ManufacturerNameAssigned": "EMPTY",
"DiversityClassification": "EMPTY",
"timestamp": "2021-09-07T14:17:38.653Z"
}
]
}
Question
In above result the first CHILD document was unwanted and solr 8.1 returned result for another product from same catalog.
Note
We are not using nest-path as mentioned in this url — https://solr.apache.org/guide/8_1/indexing-nested-documents.html
Also , Catalog Search in working fine and it returns correct child docs for a particular item.