xml - Solr query require specifically "fieldname:searchtext" for custom data -
regarding solrj interface, why default xml example (e.g. hd.xml), can query typing "samsung" in query textbox. own custom xml data, need type "fieldname:whatever". no result of data shown if don't add fieldname in front.
i made use of dynamicfield
<dynamicfield name="*_t" type="text_general" indexed="true" stored="true"/>
so added "_t" in every 1 of custom fields.
<field name="id">3</field> <field name="full_message_t">[cna] grace fu meets china’s npc vice chairperson http://t.co/6k9cle4c1x</field> <field name="source_t">cna</field> <field name="news_t">grace fu meets china’s npc vice chairperson </field> <field name="link_t">http://t.co/6k9cle4c1x</field>
so example: if type "cna" in query textbox, nothing shows up. if type "source_t:cna", expected results shows up. why so?
it seems figured problem, here step step solution:
add in fields schema.xml
<copyfield source="full_message_t" dest="text"/> <copyfield source="source_t" dest="text"/> <copyfield source="news_t" dest="text"/> <copyfield source="link_t" dest="text"/>
uncomment this:
<defaultsearchfield>text</defaultsearchfield>
restart solr.
java -jar start.jar
and (this step missed), re-import custom xml data.
java -jar post.jar [name].xml
Comments
Post a Comment