Thanks Angela, Yes you are using the wrong syntax for Lucene. The syntax should be:
³Fieldname:FieldValue² Please see the syntax here: http://lucene.apache.org/core/2_9_4/queryparsersyntax.html Cheers, Chris ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Chris Mattmann, Ph.D. Chief Architect Instrument Software and Science Data Systems Section (398) NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA Office: 168-519, Mailstop: 168-527 Email: [email protected] WWW: http://sunset.usc.edu/~mattmann/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Associate Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -----Original Message----- From: MengYing Wang <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Tuesday, October 28, 2014 at 4:17 PM To: "[email protected]" <[email protected]> Subject: Re: Error occurs when using the query_tool script of the file manager for a new product type >Hi Prof Chris, > >Done with Jira: https://issues.apache.org/jira/browse/OODT-766. This >happens with the SQL Query only, not with the Lucene. At least no >exception >is thrown out in Lucene queries. > >By the way, maybe I am using the wrong syntax, but it seems the Lucene is >much difficult to use than Sql. For example: > >Suppose I have 3 files with the GenericFile type: > >$ ./query_tool --url http://localhost:9000 --sql -query "SELECT >CAS.ProductReceivedTime,CAS.ProductName,CAS.ProductId,ProductType,ProductT >ypeId,ProductTypeName,ProductStructure,Filename,FileLocation,MimeType >FROM GenericFile" -sortBy 'CAS.ProductReceivedTime' -outputFormat >'$CAS.ProductReceivedTime,$CAS.ProductName,$CAS.ProductId,$ProductType,$Pr >oductTypeId,$ProductTypeName,$ProductStructure,$Filename,$FileLocation,$Mi >meType' > >Oct 28, 2014 3:51:31 PM >org.apache.oodt.cas.filemgr.system.XmlRpcFileManager complexQuery > >INFO: Query returned 3 results > >2014-09-15T12:41:31.241-07:00,blah.txt,4ad79161-3d10-11e4-b2be-cf9a90c3077 >d,GenericFile,GenericFileId,GenericFileName,Flat,blah.txt,/Users/AngelaWan >g/files/blah.txt,text/plain,text,plain > >2014-10-13T22:04:28.703-07:00,hello.txt,93586611-535f-11e4-9209-4d1d47528f >7d,GenericFile,GenericFileId,GenericFileName,Flat,hello.txt,/Users/AngelaW >ang/files/hello.txt,text/plain,text,plain > >2014-10-27T23:31:54.319-07:00,concatenatedOutputFile-2014-10-28T06:31:53.5 >97Z.txt,1bc212ba-5e6c-11e4-84b4-f5653df4b171,GenericFile,FileConcatenatorP >roductType,GenericFile,FileConcatenatorProductTypeId,GenericFile,FileConca >tenatorProductTypeName,Flat,concatenatedOutputFile-2014-10-28T06:31:53.597 >Z.txt,concatenatedOutputFile-2014-10-28T06:31:53.597Z.txt,/Users/AngelaWan >g/files/concatenatedOutputFile-2014-10-28T06:31:53.597Z.txt,text/plain,tex >t,plain > >All the flowing 4 Lucene queries return 0 record. > >$./query_tool --url http://localhost:9000 --lucene -query >'CAS.ProductTypeName:GenericFile' > >$./query_tool --url http://localhost:9000 --lucene -query >'ProductTypeName:GenericFile' > >$./query_tool --url http://localhost:9000 --lucene -query >'CAS.ProductTypeName:GenericFileName' > >$./query_tool --url http://localhost:9000 --lucene -query >'ProductTypeName:GenericFileName' > >Oct 28, 2014 3:57:09 PM org.apache.oodt.cas.filemgr.catalog.LuceneCatalog >paginateQuery > >WARNING: Query: [q=CAS.ProductTypeName:GenericFile] for Product Type: >[urn:oodt:GenericFile] returned no results > >Only this one gives me the correct result: > >$./query_tool --url http://localhost:9000 --lucene -query >'CAS.ProductName:blah.txt' > >4ad79161-3d10-11e4-b2be-cf9a90c3077d > > >Thanks. > >Best, > >Mengying (Angela) Wang > > > > > > >On Tue, Oct 28, 2014 at 7:24 AM, Chris Mattmann <[email protected]> >wrote: > >> Thanks for reporting this Angela. It would be great if you can >> file an issue for this in JIRA? Does this happen with the SQL >> Query only, or does it do so also with Lucene? >> >> Cheers, >> Chris >> >> ------------------------ >> Chris Mattmann >> [email protected] >> >> >> >> >> -----Original Message----- >> From: Mengying Wang <[email protected]> >> Reply-To: <[email protected]> >> Date: Tuesday, October 28, 2014 at 12:10 AM >> To: <[email protected]> >> Subject: Error occurs when using the query_tool script of the file >>manager >> for a new product type >> >> >Hi Everyone, >> > >> >According to the tutorial >> >http://oodt.apache.org/components/maven/curator/user/basic.html, I >>added >> a >> >new JSON product type to my file manager. However, if I run the >>query_tool >> >script before any json files ingested, it will raise some errors, as >>shown >> >here: >> > >> >$ ./query_tool --url http://localhost:9000 --sql -query "SELECT * FROM >> >JSON" >> >Oct 27, 2014 11:52:07 PM >>org.apache.oodt.cas.filemgr.catalog.LuceneCatalog >> >paginateQuery >> >WARNING: Query: [q=] for Product Type: [urn:example:JSON] returned no >> >results >> >java.lang.NullPointerException >> >at >> >>>org.apache.oodt.cas.filemgr.system.XmlRpcFileManager.complexQuery(XmlRpc >>>Fi >> >leManager.java:602) >> >at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) >> >at >> >>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor >>>Im >> >pl.java:43) >> >at java.lang.reflect.Method.invoke(Method.java:606) >> >at org.apache.xmlrpc.Invoker.execute(Invoker.java:130) >> >at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(XmlRpcWorker.java:84) >> >at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:146) >> >at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139) >> >at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:125) >> >at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:761) >> >at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:642) >> >at java.lang.Thread.run(Thread.java:744) >> >org.apache.xmlrpc.XmlRpcException: java.lang.Exception: >> >org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException: >>Failed to >> >perform complex query : null >> >at >> >>>org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeException(XmlRpcCl >>>ie >> >ntResponseProcessor.java:104) >> >at >> >>>org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeResponse(XmlRpcCli >>>en >> >tResponseProcessor.java:71) >> >at >> >>>org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:73) >> >at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194) >> >at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185) >> >at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178) >> >at >> >>>org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient.complexQuery( >>>Xm >> >lRpcFileManagerClient.java:990) >> >at >> >>>org.apache.oodt.cas.filemgr.tools.QueryTool.performSqlQuery(QueryTool.ja >>>va >> >:252) >> >at org.apache.oodt.cas.filemgr.tools.QueryTool.main(QueryTool.java:242) >> >Exception in thread "main" >> >org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException: >> >java.lang.Exception: >> >org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException: >>Failed to >> >perform complex query : null >> >at >> >>>org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient.complexQuery( >>>Xm >> >lRpcFileManagerClient.java:996) >> >at >> >>>org.apache.oodt.cas.filemgr.tools.QueryTool.performSqlQuery(QueryTool.ja >>>va >> >:252) >> >at org.apache.oodt.cas.filemgr.tools.QueryTool.main(QueryTool.java:242) >> > >> >By the way, if some files with the product type JSON are already >>ingested >> >in my file manager, then the query_tool script works very well. >> > >> >Thanks. >> >Mengying (Angela) Wang >> >> >> > > >-- >Best, >Mengying (Angela) Wang
