lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Varun Thacker (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SOLR-11244) Query DSL for Solr
Date Wed, 30 Aug 2017 11:46:00 GMT

    [ https://issues.apache.org/jira/browse/SOLR-11244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16147110#comment-16147110
] 

Varun Thacker edited comment on SOLR-11244 at 8/30/17 11:45 AM:
----------------------------------------------------------------

Hi Dat,

This is so cool! 


In the Solr Query DSL example html page , none of the URLs include a collection name

I tried running the collapse query parser with like this
{code}
curl -XGET http://localhost:8983/solr/test_dsl/query -d '
{
  "query": { 
    "collapse": { 
      "field": "collapse_s"
    }
  }
}'
{code}

but I get this error

{code}
2017-08-30 11:43:21.030 ERROR (qtp1911006827-19) [   x:test_dsl] o.a.s.s.HttpSolrCall null:java.lang.UnsupportedOperationException:
Query  does not implement createWeight
        at org.apache.lucene.search.Query.createWeight(Query.java:67)
        at org.apache.lucene.search.IndexSearcher.createWeight(IndexSearcher.java:734)
        at org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:724)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462)
        at org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:215)
        at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1591)
        at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1408)
        at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:575)
        at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:544)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:2483)
        at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:720)
        at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:526)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.eclipse.jetty.server.Server.handle(Server.java:534)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
        at java.lang.Thread.run(Thread.java:745)
{code}


was (Author: varunthacker):
Hi Dat,

This is so cool! 


In the Solr Query DSL example html page , none of the URLs include a collection name

I tried running the collapse query parser with like this
{code}
curl -XGET http://localhost:8983/solr/test_dsl/query -d '
{
  "query": { 
    "collapse": { 
      "field": "collapse_s"
    }
  }
}'
{code}

but I get this error

{code}
2017-08-30 11:43:21.030 ERROR (qtp1911006827-19) [   x:test_dsl] o.a.s.s.HttpSolrCall null:java.lang.UnsupportedOperationException:
Query  does not implement createWeight
        at org.apache.lucene.search.Query.createWeight(Query.java:67)
        at org.apache.lucene.search.IndexSearcher.createWeight(IndexSearcher.java:734)
        at org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:724)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462)
        at org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:215)
        at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1591)
        at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1408)
        at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:575)
        at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:544)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:2483)
        at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:720)
        at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:526)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.eclipse.jetty.server.Server.handle(Server.java:534)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
        at java.lang.Thread.run(Thread.java:745)
{code}

curl -XGET http://localhost:8983/solr/test_dsl/query -d '
{
    "query" : {
        "lucene" : {
            "df" : "collapse_s",
            "query" : "1"
        }
    }
}'

> Query DSL for Solr
> ------------------
>
>                 Key: SOLR-11244
>                 URL: https://issues.apache.org/jira/browse/SOLR-11244
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Cao Manh Dat
>            Assignee: Cao Manh Dat
>         Attachments: SOLR-11244.patch, SOLR-11244.patch, SOLR-11244.patch, Solr Query
DSL - examples.html
>
>
> It will be great if Solr has a powerful query DSL. This ticket is an extension of [http://yonik.com/solr-json-request-api/].
> Here are several examples of Query DSL
> {code}
> curl -XGET http://localhost:8983/solr/query -d '
> {
>     "query" : {
>         "lucene" : {
>             "df" : "content",
>             "query" : "solr lucene"
>         }
>     }
> }
> {code}
> the above example can be rewritten as (because lucene is the default qparser)
> {code}
> curl -XGET http://localhost:8983/solr/query -d '
> {
>     "query" : "content:(solr lucene)"
> }
> {code}
> more complex example:
> {code}
> curl -XGET http://localhost:8983/solr/query -d '
> { 
>     "query" : {
>         "boost" : {
>             "query" : {
>                 "lucene" : {
>                     "q.op" : "AND",
>                     "df" : "cat_s",
>                     "query" : "A"
>                 }
>             }
>             "b" : "log(popularity)"
>         }
>     }
> }
> {code}
> I call it Json Query Object (JQO) and It defined as :
> - It can be a valid query string for Lucene query parser, for example : "title:solr"
> - It can be a valid local parameters string, for example : "{!dismax qf=myfield}solr
rocks"
> - It can be a json object with structure like this 
> {code}
> {
>   "query-parser-name" : {
>      "param1" : "value1",
>      "param2" : "value2",
>      "query" : <JQO>,
>      "another-param" : <JQO>
>   }
> }
> {code}
> Therefore the above dismax query can be rewritten as ( be noticed that the query argument
in local parameters, is put as value of {{query}} field )
> {code}
> {
>   "dismax" : {
>      "qf" : "myfield"
>      "query" : "solr rocks"
>   }
> }
> {code}
> I will attach an HTML, contain more examples of Query DSL.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message