Reputation: 1114
I have a solr entity with a filed defind as:
<field name="rel_ids" type="long" indexed="true" stored="true" multivalue="true" />
and i fill it vie data import handler: with like this
<field column="rel_ids" sourceColName="rel_idsc" splitBy=","/>
but i can not search on this field for instance the following queries are not working:
rel_ids:1 --> no result
rel_ids:* --> no result
here is my full schema:
<schema name="example" version="1.5">
<fields>
<field name="id" type="long" indexed="true" stored="true" required="true" />
<field name="id_S100" type="long" indexed="true" stored="true" required="false" />
<field name="id_S95" type="long" indexed="true" stored="true" required="false" />
<field name="id_S90" type="long" indexed="true" stored="true" required="false" />
<field name="id_None" type="long" indexed="true" stored="true" required="false" />
<field name="text" type="text_ar" indexed="true" stored="true" />
<field name="text_noStem" type="text_ar_noStem" indexed="true" stored="true" />
<field name="text_noStem_withHarekat" type="text_ar_noStem_withHarekat" indexed="true" stored="true" />
<field name="source_book" type="string" indexed="true" stored="true" />
<field name="source_volume" type="string" indexed="true" stored="true" />
<field name="source_page" type="int" indexed="true" stored="true" />
<field name="rel_ids" type="long" indexed="true" stored="true" multiValued="true" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<copyField source="text" dest="text_noStem" />
<copyField source="text" dest="text_noStem_withHarekat" />
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
behavior of the fieldType.
Class names starting with "solr" refer to java classes in a
standard package such as org.apache.solr.analysis
-->
<!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
currently supported on types that are sorted internally as strings
and on numeric types.
This includes "string","boolean", and, as of 3.5 (and 4.x),
int, float, long, date, double, including the "Trie" variants.
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
- If sortMissingFirst="true", then a sort on this field will cause documents
without the field to come before documents with the field,
regardless of the requested sort order.
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
then default lucene sorting will be used which places docs without the
field first in an ascending sort and last in a descending sort.
-->
<!--
Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
-->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
...
and
my data import handler field matching:
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/hadithtest" user="root" password="root"/>
<document name="Hadiths" >
<entity name="hadith" transformer="RegexTransformer" query="SELECT ..." >
<field name="id" column="id" />
<field name="text" column="basetext" />
<field name="source_book" column="source_bookglossary" />
<field name="source_volume" column="source_volumestring" />
<field name="source_page" column="source_pagestring" />
<field name="id_None" column="id_None" />
<field name="id_S100" column="id_S100" />
<field name="id_S95" column="id_S95" />
<field name="id_S90" column="id_S90" />
<field column="aye_ids" sourceColName="aye_idsc" splitBy="\s+"/>
<field name="aye_ids_text" column="aye_idsc" />
<!--
<field name="TextID" column="text_id" />
<entity name="RText" query="select * from richtext where richtext.id='${hadith.TextID}'" >
<field name="Text" column="text" />
</entry>
-->
</entity>
can anyone help about this problem? (i cant query on rel_ids
Upvotes: 0
Views: 988
Reputation: 1114
I fount my mistake!
the problem is that I did not specified the transformer
in dataImport entity
tag.
so data import should be like this:
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/hadithtest" user="root" password="root"/>
<document name="Hadiths" >
<entity name="hadith" transformer="RegexTransformer" query="SELECT ..." >
<field name="id" column="id" />
<field name="text" column="basetext" />
<field name="source_book" column="source_bookglossary" />
<field name="source_volume" column="source_volumestring" />
<field name="source_page" column="source_pagestring" />
<field name="id_None" column="id_None" />
<field name="id_S100" column="id_S100" />
<field name="id_S95" column="id_S95" />
<field name="id_S90" column="id_S90" />
<field column="aye_ids" sourceColName="aye_idsc" splitBy="\s+"/>
<field name="aye_ids_text" column="aye_idsc" />
<!--
<field name="TextID" column="text_id" />
<entity name="RText" query="select * from richtext where richtext.id='${hadith.TextID}'" >
<field name="Text" column="text" />
</entry>
-->
</entity>
</document>
</dataConfig>
Upvotes: 2