2014-03-14 4 views
11

solr에 중첩 된 schema.xml을 작성하는 방법은 무엇입니까? SOLR에 중첩의 schema.xml을 작성하는 방법을

의 schema.xml의 문서는

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers

에서 사용할 수있는

<!-- points to the root document of a block of nested documents. Required for nested 
document support, may be removed otherwise 
--> 
<field name="_root_" type="string" indexed="true" stored="false"/> 

http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?view=markup

어떤 것 ' 다음 항목을 중첩하는 schema.xml이 있어야합니다.

  • 사람 문자열
  • 주소
    • 도시 문자열
    • 우편 번호 문자열

답변

5

나는이 오래된 질문 알아요,하지만 난 유사한 문제에 달렸다.

<field name="person" type="string" indexed="true" stored="true" /> 
<field name="address" type="string" indexed="true" stored="true" multiValued="true"/> 
<field name="address.city" type="string" indexed="true" stored="true" /> 
<field name="address.postcode" type="string" indexed="true" stored="true" /> 

을 당신이 그것을 실행하면 다음 당신은 당신의 SOLR 인스턴스에 다음 JSON을 추가하고 일치를 볼 수 있어야합니다 다음과 같이 당신에 대한 내 솔루션을 수정, 당신이 당신의 schema.xml에 추가하는 데 필요한 필드는 쿼리의 결과 :

{ 
    "person": "John Smith", 
    "address": { 
     "city": "San Diego", 
     "postcode": 92093 
    } 
} 
+3

다중 값이 참이면 주소 목록이 아니겠습니까? – aaa90210

관련 문제