我能夠通過solr DIH導入數據。保持索引索引中的關係數據庫結構?
在我的數據庫中,我有4個表:
threads: id, user_id, country_id
tags: id
thread_tag_map: thread_id, tag_id
countries: id
posts: id, thread_id
我想Solr中的每個文件包括:
thread_id
tag_id
country_id
post_id
例如:
thread_id: 1
tag_id: 23
tag_id: 34
country_id: 43
post_id: 4
post_id: 23
post_id: 23
我應該如何映射它?
我還沒有能夠爲此配置data-config.xml。我沒有成功地遵循DIH教程。
這裏是我的schema.xml:
<schema name="example" version="1.2">
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="uuid" class="solr.UUIDField" indexed="true" />
<fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
enablePositionIncrements="true"
/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="id" type="uuid" indexed="true" stored="true" default="NEW"/>
<field name="threads.title" type="text_rev" indexed="true" stored="true"/>
<field name="posts.body" type="text_rev" indexed="true" stored="true"/>
<dynamicField name="*id" type="int" indexed="false" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>posts.body</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
</schema>
還沒有人已經做到這一點,可以給我一些幫助? – ajsie 2009-12-14 13:36:20
請張貼您的schema.xml – 2009-12-14 18:28:16