2017-02-13 3 views
2

사용할 수있는 필드 유형간에 약간의 혼란이 있습니다. stringstringsintints 및 기타 데이터 유형에 대한 선호도.필드 유형 문자열 대 문자열

다음 4 가지 차이점은 무엇입니까?

<field name="string_multi" type="string" multiValued="true" indexed="true" stored="true"/> 
<field name="string_single" type="string" indexed="true" stored="true"/> 
<field name="strings_multi" type="strings" multiValued="true" indexed="true" stored="true"/> 
<field name="strings_single" type="strings" indexed="true" stored="true"/> 

문서가있는 경우, hashtags이라는 필드에 대해 무엇을 선언해야합니까?

String multivalued 또는 strings multivalue 또는 strings without multivalue,?

<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true" /> 
<fieldType name="strings" class="solr.StrField" sortMissingLast="true" multiValued="true" docValues="true" /> 

을 편집

: 실제로 fieldType 정의를 보면 잘

{ 
     "polarity":0.0, 
     "text":"RT @socialistudents: Vlad - we go to NUS conference not just as individuals but as members of Socialist Students #SocStu17", 
     "created_at":"Sun Feb 12 19:28:34 +0000 2017", 
     "hashtags":[ 
     "hashtag1", 
     "hashtag2" 
     ], 
     "subjectivity":0.0, 
     "retweet_recount":4, 
     "id":830861171582439424, 
     "favorite_count":0 
} 

답변

3

당신이, 당신이 SOLR의 기본 스키마를 사용할 때 만들어진 기본 필드 유형에 대해 이야기하는 경우는이 말한다 : 두 번째 예는 string

대신 strings이되어야합니다. 따라서 실제로 동일한 유형 (solr의 기본 문자열 클래스 solr.StrField)이므로 동일한 유형입니다 데이터의. 유일한 차이점은 '문자열'이 다중 값이므로 하나의 필드에 여러 개의 개별 값을 저장할 수 있음을 의미합니다.

예를 들어 해시 태그 데이터는 개별 해시 태그 값의 배열 일 뿐인 것처럼 보이므로 한 필드에 여러 개의 개별 문자열을 저장하려는 경우 '문자열'이 다중 값이므로 선택 사항이됩니다.

+2

'필드 이름'을 정의 할 때 혼동이있었습니다. 따라서 'multiValued' 속성을'field name = "your_field_name"type = "strings"로 선언 할 수 있습니다 multiValued = "true"sortMissingLast = "true"docValues ​​= "true"indexed = "false"required = "true"stored = "true"/>'. 음, 그들은 똑같은 것으로 드러납니다. 조금 혼란스럽고'필드 이름'중에'multiValued'가 중복됩니다. 'multiValued'는'field type'에 의해 결정됩니다. –

+0

예, 미안합니다. 두 번째 것에 's'를 놓쳤습니다. 고정 – Jayce444

+0

그래, 필드에 '다중 값'을 선언 할 수도 있습니다. 그래서 해시 태그 데이터 구조가 주어진다면 필드 정의에'multiValued = "true"'를 넣을 수 있습니다 – Jayce444