Re: update doc with a xml-format string
Hi Daniel The CDATA block works. the raw data is actually what I want. Thanks a lot Regards 2013/12/20 yypvsxf19870706 yypvsxf19870...@gmail.com Your suggestions light me. The type is just string. I will try the left advices . Thanks a lot. 发自我的 iPhone 在 2013-12-20,19:09,Daniel Collins danwcoll...@gmail.com 写道: What's the schema definition for that field? Are you stripping HTML in your analyzer chain? Can you run it through the analyzer screen in the admin UI to confirm that the raw data goes through as you expect? Can you add a document via the admin UI and see that the data in the index is correct? Have you ever had valid data in that field? That would already confirm whether the problem is in your index definition or your indexing code. You still haven't given us much to go on... On 20 December 2013 10:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi thanks. I add the CDATA like : update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress ![CDATA[rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root]]/field/doc/addcommit=true and the field jobFirstRunExpress in the doc just like : jobFirstRunExpress:REP_DATE20130930 and REP_DATE20131003 it seems the xml tags were omitted. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 14:18, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. [...] Ah, sorry, I missed that. As others have followed up, you need to escape the XML that is within that field. Regards, Gora
update doc with a xml-format string
Hi solr users I have a string field to store a xml string. Now I want to update the field.I use the command. http://10.7.23.122:8080/solr/meta_core/update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root /field/doc/addcommit=true The red color string is what I want to update .However it give out an error: response lst name=responseHeader int name=status400/int int name=QTime3/int /lst lst name=error str name=msgunexpected XML tag doc/root/str int name=code400/int /lst /response Is there any way to acheive my requirement? Any suggestion will be appreciated. Regards
Re: update doc with a xml-format string
On 20 December 2013 13:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi solr users I have a string field to store a xml string. Now I want to update the field.I use the command. http://10.7.23.122:8080/solr/meta_core/update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root /field/doc/addcommit=true The red color string is what I want to update .However it give out an error: Um, the error message is pretty clear. Your XML is not in the format that Solr expects: You have a root tag that Solr does not understand. Please see http://wiki.apache.org/solr/UpdateXmlMessages for the required XML format. Regards, Gora
Re: update doc with a xml-format string
Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. The url I have not found I want. Any way,thanks a lot. Regards. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 13:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi solr users I have a string field to store a xml string. Now I want to update the field.I use the command. http://10.7.23.122:8080/solr/meta_core/update?stream.body= adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root /field/doc/addcommit=true The red color string is what I want to update .However it give out an error: Um, the error message is pretty clear. Your XML is not in the format that Solr expects: You have a root tag that Solr does not understand. Please see http://wiki.apache.org/solr/UpdateXmlMessages for the required XML format. Regards, Gora
Re: update doc with a xml-format string
Yes, but you are putting the root tag (which is an XML construct) as a value of an XML element, so it has to be encoded? You've put it in quotes, but that's not valid as far as XML is concerned. I'm not an XML expert but all the XML tags (root, conditionGroup, etc) have to encoded so they aren't parsed by the entity that is parsing the field tag (i.e. Solr's request parser). I think you need something like field update=set name=jobFirstRunExpress lt;rootgt;lt;conditionGroupgt;lt;conditionEntry ... /field I don't know the correct way to encode the rest but that should be a standard XML problem to solve, if you search around for that. Basically, the value of the field tag needs to be a string that has no XML tags within it otherwise Solr will try to parse it (and fail since it isn't in Solr's XML format for updates). On 20 December 2013 08:48, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. The url I have not found I want. Any way,thanks a lot. Regards. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 13:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi solr users I have a string field to store a xml string. Now I want to update the field.I use the command. http://10.7.23.122:8080/solr/meta_core/update?stream.body= adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root /field/doc/addcommit=true The red color string is what I want to update .However it give out an error: Um, the error message is pretty clear. Your XML is not in the format that Solr expects: You have a root tag that Solr does not understand. Please see http://wiki.apache.org/solr/UpdateXmlMessages for the required XML format. Regards, Gora
Re: update doc with a xml-format string
Alternatively, use something like http://www.w3schools.com/xml/xml_cdata.asp and put all your values in a CDATA block. Again, I'm not an XML guru but something like that should get you moving. On 20 December 2013 09:05, Daniel Collins danwcoll...@gmail.com wrote: Yes, but you are putting the root tag (which is an XML construct) as a value of an XML element, so it has to be encoded? You've put it in quotes, but that's not valid as far as XML is concerned. I'm not an XML expert but all the XML tags (root, conditionGroup, etc) have to encoded so they aren't parsed by the entity that is parsing the field tag (i.e. Solr's request parser). I think you need something like field update=set name=jobFirstRunExpress lt;rootgt;lt;conditionGroupgt;lt;conditionEntry ... /field I don't know the correct way to encode the rest but that should be a standard XML problem to solve, if you search around for that. Basically, the value of the field tag needs to be a string that has no XML tags within it otherwise Solr will try to parse it (and fail since it isn't in Solr's XML format for updates). On 20 December 2013 08:48, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. The url I have not found I want. Any way,thanks a lot. Regards. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 13:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi solr users I have a string field to store a xml string. Now I want to update the field.I use the command. http://10.7.23.122:8080/solr/meta_core/update?stream.body= adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root /field/doc/addcommit=true The red color string is what I want to update .However it give out an error: Um, the error message is pretty clear. Your XML is not in the format that Solr expects: You have a root tag that Solr does not understand. Please see http://wiki.apache.org/solr/UpdateXmlMessages for the required XML format. Regards, Gora
Re: update doc with a xml-format string
On 20 December 2013 14:18, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. [...] Ah, sorry, I missed that. As others have followed up, you need to escape the XML that is within that field. Regards, Gora
Re: update doc with a xml-format string
Hi thanks. I add the CDATA like : update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress ![CDATA[rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root]]/field/doc/addcommit=true and the field jobFirstRunExpress in the doc just like : jobFirstRunExpress:REP_DATE20130930 and REP_DATE20131003 it seems the xml tags were omitted. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 14:18, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. [...] Ah, sorry, I missed that. As others have followed up, you need to escape the XML that is within that field. Regards, Gora
Re: update doc with a xml-format string
What's the schema definition for that field? Are you stripping HTML in your analyzer chain? Can you run it through the analyzer screen in the admin UI to confirm that the raw data goes through as you expect? Can you add a document via the admin UI and see that the data in the index is correct? Have you ever had valid data in that field? That would already confirm whether the problem is in your index definition or your indexing code. You still haven't given us much to go on... On 20 December 2013 10:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi thanks. I add the CDATA like : update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress ![CDATA[rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root]]/field/doc/addcommit=true and the field jobFirstRunExpress in the doc just like : jobFirstRunExpress:REP_DATE20130930 and REP_DATE20131003 it seems the xml tags were omitted. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 14:18, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. [...] Ah, sorry, I missed that. As others have followed up, you need to escape the XML that is within that field. Regards, Gora
Re: update doc with a xml-format string
Your suggestions light me. The type is just string. I will try the left advices . Thanks a lot. 发自我的 iPhone 在 2013-12-20,19:09,Daniel Collins danwcoll...@gmail.com 写道: What's the schema definition for that field? Are you stripping HTML in your analyzer chain? Can you run it through the analyzer screen in the admin UI to confirm that the raw data goes through as you expect? Can you add a document via the admin UI and see that the data in the index is correct? Have you ever had valid data in that field? That would already confirm whether the problem is in your index definition or your indexing code. You still haven't given us much to go on... On 20 December 2013 10:57, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi thanks. I add the CDATA like : update?stream.body=adddocfield name=nameshardTv_20131031/fieldfield update=set name=jobFirstRunExpress ![CDATA[rootconditionGroupconditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20130930/val/conditionEntry opand/op conditionEntry type=\string\ isChangeable=\true\ keyREP_DATE/keyop/opval20131003/val/conditionEntry/conditionGroup/root]]/field/doc/addcommit=true and the field jobFirstRunExpress in the doc just like : jobFirstRunExpress:REP_DATE20130930 and REP_DATE20131003 it seems the xml tags were omitted. 2013/12/20 Gora Mohanty g...@mimirtech.com On 20 December 2013 14:18, YouPeng Yang yypvsxf19870...@gmail.com wrote: Hi Thanks for your reply. The root/root is actually what I want to update the doc. That is I intend to update the xml string to one of the fields of my doc. [...] Ah, sorry, I missed that. As others have followed up, you need to escape the XML that is within that field. Regards, Gora