Hi,

Sorry for letting this thread hanging, I was out of office last week.

I have managed to make it work using this query:
http://localhost:8983/solr/testscoring/select?q={!parent%20which=type_s:product%20score=max}+color_s:Red^=0%20AND%20{!func}price_i&wt=json&indent=true&fl=score,*,[docid]&debugQuery=true
for the example in your blog, and the result is like this:

{
  "responseHeader":{
    "status":0,
    "QTime":2},
  "response":{"numFound":2,"start":0,"maxScore":300.0,"docs":[
      {
        "id":"2",
        "type_s":"product",
        "name_s":"expensive red",
        "_version_":1511105298931122176,
        "score":300.0,
        "[docid]":5},
      {
        "id":"1",
        "type_s":"product",
        "name_s":"expensive blue",
        "_version_":1511105298905956352,
        "score":10.0,
        "[docid]":2}]
  },
  "debug":{
    "rawquerystring":"{!parent which=type_s:product score=max} color_s:Red^=0 AND 
{!func}price_i",
    "querystring":"{!parent which=type_s:product score=max} color_s:Red^=0 AND 
{!func}price_i",
    "parsedquery":"ToParentBlockJoinQuery(ToParentBlockJoinQuery 
(+ConstantScore(color_s:Red)^0.0 +int(price_i)))",
    "parsedquery_toString":"ToParentBlockJoinQuery (+ConstantScore(color_s:Red)^0.0 
+int(price_i))",
    "explain":{
      "2":"\n300.0 = Score based on child doc range from 3 to 4\n",
      "1":"\n10.0 = Score based on child doc range from 0 to 1\n"},
    "QParser":"BlockJoinParentQParser",
    "timing":{
      "time":2.0,
      "prepare":{
        "time":0.0,
        "query":{
          "time":0.0},
        "facet":{
          "time":0.0},
        "facet_module":{
          "time":0.0},
        "mlt":{
          "time":0.0},
        "highlight":{
          "time":0.0},
        "stats":{
          "time":0.0},
        "expand":{
          "time":0.0},
        "debug":{
          "time":0.0}},
      "process":{
        "time":1.0,
        "query":{
          "time":0.0},
        "facet":{
          "time":0.0},
        "facet_module":{
          "time":0.0},
        "mlt":{
          "time":0.0},
        "highlight":{
          "time":0.0},
        "stats":{
          "time":0.0},
        "expand":{
          "time":0.0},
        "debug":{
          "time":0.


Is possible to to also add "name_s:expensive" search term in q? I know i can add it to fq but I will have no score boost.

Thank you


On 01.09.2015 15:29, Mikhail Khludnev wrote:
I suspect URL encoding might mess with MUST (+) clause. Can you post
debugQuery=true output to make sure that the query parsed right.
Then make sure that chid query and parent filter are fully orthogonal. eg
+type_s:product +color_s:Red returns no result.
Last check to check, make sure that you don't have deleted document in the
index for a while. You can check in at SolrAdmin.

On Tue, Sep 1, 2015 at 1:42 PM, Florin Mandoc <flori...@mejix.com> wrote:

Hi,

I have tried the solution from your blog with my schema and with the
example from the blog post, with solr-5.3.0 and with solr-5.4. 0-2015-08-12
and i get this error:

"responseHeader":{
     "status":500,
     "QTime":32},
   "error":{
     "msg":"child query must only match non-parent docs, but parent docID=2
matched childScorer=class org.apache.lucene.search.DisjunctionSumScorer",
     "trace":"java.lang.IllegalStateException: child query must only match
non-parent docs, but parent docID=2 matched childScorer=class
org.apache.lucene.search.DisjunctionSumScorer\n\tat
org.apache.lucene.search.join.ToParentBlockJoinQuery$BlockJoinScorer.nextDoc(ToParentBlockJoinQuery.java:311)\n\tat
org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:216)\n\tat
org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:169)\n\tat
org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)\n\tat
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:772)\n\tat
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:486)\n\tat
org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:200)\n\tat
org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1682)\n\tat
org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1501)\n\tat
org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:555)\n\tat
org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:522)\n\tat
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:277)\n\tat
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)\n\tat
org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)\n\tat
org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:669)\n\tat
org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:462)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:210)\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)\n\tat
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\n\tat
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\n\tat
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\n\tat
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)\n\tat
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\n\tat
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\n\tat
org.eclipse.jetty.server.Server.handle(Server.java:499)\n\tat
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\n\tat
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\n\tat
org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\n\tat
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\n\tat
java.lang.Thread.run(Thread.java:745)\n",
     "code":500}

The query is for your example

http://localhost:8983/solr/testscore/select?q={!parent%20which=type_s:product%20score=max}+color_s:Red
<http://localhost:8983/solr/testscore/select?q=%7B!parent%20which=type_s:product%20score=max%7D+color_s:Red>
^=0%20{!func}price_i&wt=json&indent=true&fl=score,*,[docid]

Do you have any idea why i get this error?

Thank you



On 31.08.2015 15:48, Mikhail Khludnev wrote:

Florin,

I disclosure some details in the recent post
http://blog.griddynamics.com/2015/08/scoring-join-party-in-solr-53.html.
Let me know if you have further questions afterwards.
I also notice that you use "obvious" syntax: BuyerID=83 but it's hardly
ever possible. There is a good habit of debugQuery=true, which allows to
reconcile query interpretation.

On Mon, Aug 31, 2015 at 2:40 PM, Florin Mandoc <flori...@mejix.com>
wrote:

Hi,
I am trying to model am index from a relational database and i have 3
main
entity types: products, buyers and sellers.
I am using nested documents for sellers and buyers, as i have many
sellers
and many buyers for one product:

{ "Active" : "true",
    "CategoryID" : 59,
    "CategoryName" : "Produce",
    "Id" : "227686",
    "ManufacturerID" : 322,
    "ManufacturerName" : "-------",
    "Name" : "product name",
    "ProductID" : "227686",
    "SKU" : "DAFA2A1F047E438B8462667F987D80A5",
    "ShortDescription" : "s description",
    "type" : "product",
    "UOM" : "Unit",
    "UomSize" : "48",
    "_childDocuments_" : [ { "BuyerID" : 83,
          "DisplayOrder" : 0,
          "ProductID" : "227686",
          "id" : "227686_83",
          "type" : "buyer"
        },
        { "BuyerID" : 86,
          "DisplayOrder" : 10,
          "ProductID" : "227686",
          "id" : "227686_86",
          "type" : "buyer"
        },
        { "BuyerID" : 83,
          "ProductID" : "227686",
          "SellerID" : 84,
          "SellerName" : "Seller 84",
          "id" : "227686_83_84",
          "type" : "seller"
        },
        { "BuyerID" : 83,
          "ProductID" : "227686",
          "SellerID" : 89,
          "SellerName" : "Seller 89",
          "id" : "227686_83_89",
          "type" : "seller"
        }
      ],
    "_version_" : 1509403723402575872
}

To query i use:
http://localhost:8983/solr/dine/select?q=Name:"product
name"&fq={!parent%20which=type:product v="type:buyer AND

BuyerID=83"}&wt=json&indent=true&fl=*,[child%20parentFilter=type:product%20childFilter=%22((type:buyer%20AND%20BuyerSiteID:83)%20OR%20(type:seller%20AND%20BuyerSiteID:83))]&rows=1000

and i get the product, buyer and sellers details, but i want to have the
products of BuyerID:83 sorted by DisplayOrder field.

Is this possible to achieve this, and how?

Thank you





Reply via email to