It is easier to put SQL select statements in a view, and just use that
view from the DIH configuration file.

On Tue, Oct 27, 2009 at 12:30 PM, Andrew Clegg <andrew.cl...@gmail.com> wrote:
>
>
> Heh, eventually I decided
>
> "where 4 > node_depth"
>
> was the most pleasing (if slightly WTF-ish) way of writing it...
>
> Cheers,
>
> Andrew.
>
>
> Erik Hatcher-4 wrote:
>>
>> Use &lt; instead of < in that attribute.  That should fix the issue.
>> Remember, it's an XML file, so it has to obey XML encoding rules which
>> make it ugly but whatcha gonna do?
>>
>>       Erik
>>
>> On Oct 27, 2009, at 11:50 AM, Andrew Clegg wrote:
>>
>>>
>>> Hi,
>>>
>>> If I have a DataImportHandler query with a greater-than sign in,
>>> like this:
>>>
>>>        <entity name="higher_node" dataSource="database"
>>> query="select *,
>>> title as keywords from cathnode_text where node_depth > 4">
>>>
>>> Everything's fine. However, if it contains a less-than sign:
>>>
>>>        <entity name="higher_node" dataSource="database"
>>> query="select *,
>>> title as keywords from cathnode_text where node_depth < 4">
>>>
>>> I get this exception:
>>>
>>> INFO: Processing configuration from solrconfig.xml:
>>> {config=dataconfig.xml}
>>> [Fatal Error] :240:129: The value of attribute "query" associated
>>> with an
>>> element type "null" must not contain the '<' character.
>>> 27-Oct-2009 15:30:49
>>> org.apache.solr.handler.dataimport.DataImportHandler
>>> inform
>>> SEVERE: Exception while loading DataImporter
>>> org.apache.solr.handler.dataimport.DataImportHandlerException:
>>> Exception
>>> occurred while initializing context
>>>        at
>>> org
>>> .apache
>>> .solr
>>> .handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:184)
>>>        at
>>> org
>>> .apache
>>> .solr.handler.dataimport.DataImporter.<init>(DataImporter.java:101)
>>>        at
>>> org
>>> .apache
>>> .solr
>>> .handler.dataimport.DataImportHandler.inform(DataImportHandler.java:
>>> 113)
>>>        at
>>> org
>>> .apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:
>>> 424)
>>>        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:588)
>>>        at
>>> org.apache.solr.core.CoreContainer
>>> $Initializer.initialize(CoreContainer.java:137)
>>>        at
>>> org
>>> .apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:
>>> 83)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:
>>> 275)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .core
>>> .ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:
>>> 397)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
>>>        at
>>> org
>>> .apache
>>> .catalina.core.StandardContext.filterStart(StandardContext.java:3709)
>>>        at
>>> org.apache.catalina.core.StandardContext.start(StandardContext.java:
>>> 4356)
>>>        at
>>> org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:
>>> 1244)
>>>        at
>>> org
>>> .apache
>>> .catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:
>>> 604)
>>>        at
>>> org
>>> .apache
>>> .catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:
>>> 129)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .core
>>> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
>>> 290)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>        at
>>> org
>>> .apache
>>> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
>>> 233)
>>>        at
>>> org
>>> .apache
>>> .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
>>> 175)
>>>        at
>>> org
>>> .apache
>>> .catalina
>>> .authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
>>>        at
>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
>>> 568)
>>>        at
>>> org
>>> .apache
>>> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>        at
>>> org
>>> .apache
>>> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>        at
>>> org
>>> .apache
>>> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
>>> 109)
>>>        at
>>> org
>>> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
>>> 286)
>>>        at
>>> org
>>> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>>> 844)
>>>        at
>>> org.apache.coyote.http11.Http11Protocol
>>> $Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>        at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
>>> 447)
>>>        at java.lang.Thread.run(Thread.java:619)
>>> Caused by: org.xml.sax.SAXParseException: The value of attribute
>>> "query"
>>> associated with an element type "null" must not contain the '<'
>>> character.
>>>        at
>>> com
>>> .sun
>>> .org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:
>>> 239)
>>>        at
>>> com
>>> .sun
>>> .org
>>> .apache
>>> .xerces
>>> .internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
>>>        at
>>> org
>>> .apache
>>> .solr
>>> .handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:172)
>>>        ... 30 more
>>>
>>> Is this fixable, or an unavoidable feature of Xerces? If the latter,
>>> perhaps
>>> the docs could benefit from a note to say "use NOT a >= b" or
>>> something?
>>>
>>> Speaking of, I found this in the wiki examples for the DIH:
>>>
>>>            <entity name="item" pk="ID"
>>>                query="select * from item"
>>>                deltaImportQuery="select * from item where
>>> ID=='${dataimporter.delta.id}'"
>>>                deltaQuery="select id from item where last_modified >
>>> '${dataimporter.last_index_time}'">
>>>
>>> Shouldn't that be one equals sign:
>>>
>>>                deltaImportQuery="select * from item where
>>> ID='${dataimporter.delta.id}'"
>>>
>>> Or is it doing something clever with Java operators?
>>>
>>> Cheers,
>>>
>>> Andrew.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Greater-than-and-less-than-in-data-import-SQL-queries-tp26080100p26080100.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Greater-than-and-less-than-in-data-import-SQL-queries-tp26080100p26083680.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
Lance Norskog
goks...@gmail.com

Reply via email to