[siren-user] Indexing and search triple
Renaud Delbru
renaud.delbru at deri.org
Wed Dec 14 10:01:19 GMT 2011
Hi Blanca,
you need to put the query type to siren. You can do this with
query.setQueryType("siren");
if you are using solrj
regards
--
Renaud Delbru
On 14/12/11 09:55, Blanca Hernández wrote:
>
> Hello!
> My name is Blanca, and I have just started to use this plugin.
> The documentation seems to be very clear, but I'm having problems when I
> try to index/search triples in my system.
>
> First of all, I'll show you my configuration
>
> *SOLR.CONFIG*
> <!-- Example of Registration of the siren query parser. -->
> <queryParser name="siren"
> class="org.sindice.siren.solr.SirenQParserPlugin"/>
> <requestHandler name="siren" class="solr.StandardRequestHandler">
> <!-- default values for query parameters -->
> <lst name="defaults">
> <str name="defType">siren</str>
> <str name="echoParams">explicit</str>
> <!-- Disable field query in keyword parser -->
> <str name="disableField">true</str>
> <str name="qf">
> ntriple^1.0 url^1.2
> </str>
> <str name="nqf">
> ntriple^1.0
> </str>
> <!-- the NTriple query multi-field operator:
> - disjunction: the query should match in at least one of the fields
> - scattered: each Ntriple patterns should match in at least on of the fields
> -->
> <str name="nqfo">scattered</str>
> <str name="fl">
> id
> </str>
> </lst>
> </requestHandler>
>
> *SQUEMA.XML*
> <!-- Triples -->
> <fieldType name="ntriple" class="org.sindice.siren.solr.schema.SirenField"
> omitNorms="true"
> omitTermFreqAndPositions="false"
> analyzerConfig="ntriple-analyzers.xml"
> datatypeConfig="ntriple-datatypes.xml"/>
>
> <field name="ntripleField" type="ntriple" indexed="true" stored="false"
> multiValued="false"/>
>
>
> Then, the indexing process:
>
> String valueToIndex = "<"+ subject + "> " +
> "<" + predicate + "> " +
> "<" + object + "> .";
>
> SolrInputDocument document = new SolrInputDocument();
>
> document.addField("idHighlight", idHigh); //Id generated
> document.addField("ntripleField", valueToIndex);
> solrClient.add(document);
>
>
> Just before commit this document, this is what it holds:
>
> SolrInputDocument[{idHighlight=idHighlight(1.0)={httpmspsonydadccomexamplestalentbob%20dylanhttpwwww3org200207owlsameashttpmspsonydadccomexamplestalentbob%20dylan},
> ntripleField=ntripleField(1.0)={<http://msp.sonydadc.com/examples/talent/Bob%20Dylan>
> <http://www.w3.org/2002/07/owl#sameAs>
> <http://msp.sonydadc.com/examples/talent/Bob%20Dylan> .}}]
>
>
>
> No errors so far, but when I try to make a query, such a:
> ntripleField:(<http//rhizomik.net/ontologies/2011/06/mspontology.owl#haslocation
> <http://rhizomik.net/ontologies/2011/06/mspontology.owl#haslocation>> * *)
>
> from my solr interface, the error comes:
>
> Estado HTTP 500 - FieldType: SirenField (ntriple) does not support field
> query org.apache.solr.common.SolrException: FieldType: SirenField
> (ntriple) does not support field query at
> org.sindice.siren.solr.schema.SirenField.createAndLogOnceException(SirenField.java:123)
> at
> org.sindice.siren.solr.schema.SirenField.getFieldQuery(SirenField.java:151)
> at
> org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:153)
> at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1421)
> at
> org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1309)
> at
> org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1237)
> at
> org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1313)
> at
> org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1237)
> at
> org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1226)
> at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
> at
> org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:80)
> at org.apache.solr.search.QParser.getQuery(QParser.java:142) at
> org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:84)
> at
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
> at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360) at
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
> at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:680)
>
>
> If I only want to see what is inside a document just stored, I perform a
> query ntripleFIeld:(*), and then a document is:
>
> <doc><str name="idHighlight">
> httpmspsonydadccomexamplestalentbob%20dylanhttpwwww3org200207owlsameashttpmspsonydadccomexamplestalentbob%20dylan</str></doc>
>
>
> Shouldn't it holds as well the ntripleFIeld?? What am I missing?
>
> Thank you very much in advance!
>
>
>
>
> This body part will be downloaded on demand.
More information about the siren
mailing list