2016-07-29 2 views
0

하위 문서를 가져 오기 위해 블록 조인 쿼리를 실행하려고하는데 "상위 쿼리에서 부모 필터와 일치하지 않는 문서를 생성합니다"오류가 발생합니다. 내가 SOLR 5.5하위 문서에 대한 Solr 쿼리 방법

내 스키마는 다음과 같습니다을 사용하고 있습니다 :

삽입 문은 다음과 같습니다

<field name="url" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
<field name="name" type="text_en" indexed="true" stored="true" required="true" multiValued="false" /> 
<field name="content_type" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
<uniqueKey>url</uniqueKey> 
: 콘솔이 3을 다시 끌어에서 표준 *:* 쿼리를 실행

{ 
    "url": "http://www.test.com/index.html", 
    "name": "parent product", 
    "content_type": "parentDocument", 
    "_childDocuments_": [ 
    { 
     "url": "http://www.test.com/index2.html", 
     "name": "child product", 
     "content_type": "childDocument" 
    }, 
    { 
     "url": "http://www.test.com/index3.html", 
     "name": "child product 2", 
     "content_type": "childDocument" 
    } 
    ] 
} 

자녀가 부모에게 속해 있다는 것을 보여줍니다.

{ 
    "docs": [ 
    { 
     "url": "http://www.test.com/index2.html", 
     "name": "child product", 
     "content_type": "childDocument", 
     "_root_": "http://www.test.com/index.html" 
    }, 
    { 
     "url": "http://www.test.com/index3.html", 
     "name": "child product 2", 
     "content_type": "childDocument", 
     "_root_": "http://www.test.com/index.html" 
    }, 
    { 
     "url": "http://www.test.com/index.html", 
     "name": "test product", 
     "content_type": "parentDocument", 
     "_version_": 1541193313504198700, 
     "_root_": "http://www.test.com/index.html" 
    } 
    ] 
} 
내가 쿼리의 어떤 종류를 추가하는 경우하지만, 예를 들어 오류가

{ 
    "responseHeader": { 
    "status": 0, 
    "QTime": 0, 
    "params": { 
     "q": "{!child of=\"content_type:parentDocument\"}", 
     "indent": "true", 
     "wt": "json" 
    } 
    }, 
    "response": { 
    "numFound": 1, 
    "start": 0, 
    "docs": [ 
     { 
     "url": "http://www.test.com/index.html", 
     "name": "test product", 
     "content_type": "parentDocument", 
     "_version_": 1541193313504198656, 
     "_root_": "http://www.test.com/index.html" 
     } 
    ] 
    } 
} 

을 : 나는 q={!child of="content_type:parentDocument"}을 실행하면 617,451,515,

그러나 나는 문은 "의 아이를"주어진 기대하지 않을 것이다 부모 문서를 얻을 수

q={!child of="content_type:parentDocument"}name:product 

또는

q={!child of="content_type:parentDocument"}name:* 

"부모 필터에 의해 일치하지 않는 부모 쿼리 수율 문서 수있는 ID = 0"그래서 나는 지금 쿼리가 자식 문서를 반환 할 수 없습니다 그것을 이해

답변

0

. 거의 쿼리와 필터와 비슷합니다. 검색어 (예 : name:*)는 허용되지 않는 상위 문서 및 하위 문서와 일치 할 수 있습니다. 추가 필터 (예 : +name:product +content_type:parentDocument)를 추가하여 검색 결과를 부모에게만 제한합니다.

{!child of="content_type:parentDocument"}+name:product +content_type:parentDocument 

을 예상대로이 작품 : 나는 이들 부모의 자녀들이 내가 지금이 얻을 수있는 {!child of="content_type:parentDocument"}을 추가했다.

마찬가지로 역은 다음과 같습니다 https://medium.com :

{!parent which="content_type:parentDocument"}+name:product +content_type:childDocument 

name:product

+0

이 할 수있는 방법이 있나요 SOLR 5.3처럼 보인다 아동의 부모를 얻으려면/@ alisazhila/solr-s-nesting-on-solr-s-capabilities-to-handle-deep-nested-document-structures-50eeaaa4347a – adam

관련 문제