thanks for help, I managed to get some results with json.facet:
{ high_popularity : {
    type : query,
    q : "+{!child of=state:*}state:Michigan+{!child
of=city:*}city:'Benton'",
    facet :{top_genres:{type: terms,field: c_gender}}
}
}

but in this case operator to link conditions is defined by solrQueryParser,
defaultOperator param in schema.xml.
Are there any way to define which operator I want to use in the query?

Also seems that  it's impossible to specify numeric conditions, such query
leads to error (I have c_age in child documents too)
{ high_popularity : {
    type : query,
    q : "+{!child of=state:*}state:Michigan+{!child
of=city:*}city:'Benton'+c_age:[10:40]",
    facet :{top_genres:{type: terms,field: c_gender}}
}
}



Regarding error with default text field -- it was definitely result of that
query, I also got 400, undefined field Review_Text in response(it was
defined as default query field in solrconfig.xml ) . After add field, I
results, but again, they are linked by OR condition


2015-10-08 16:53 GMT+03:00 Mikhail Khludnev <mkhlud...@griddynamics.com>:

> >
> >  { high_popularity : {
> >     type : query,
> >     q : "{!child of=city:Auburn}city:Auburn AND c_window:seaview",
> >     facet :{top_genres:{type: terms,field: c_gender}}
> > }
> > }
>
>
> I'm not sure about facets, but query isn't correct in should be something
> like
>   q : "+c_window:seaview +{!child of="_id:[* TO *]"}city:Auburn",
> of filter should match all parents docs! it's convenient to index
> parent:true field.
>
>     q : "{!child of=city:Auburn}city:Auburn AND {child
> of=state:Washingthon}state:Washingthon",
>
> it should be rewritten as (I'm ashamed to say why)
>
>     q : "+{!child of="_id:[* TO *]"}city:Auburn +{child
> of="_id:[* TO *]"}state:Washingthon",
>
> I don't believe that stack trace is caused by the shown request, because it
> hiccups on query facet, which you didn't show:
>
>         at
> org.apache.solr.search.facet.FacetQueryParser.parse(FacetRequest.java:473)
>         at
>
> org.apache.solr.search.facet.FacetParser.parseQueryFacet(FacetRequest.java:255)
>         at
>
> org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:238)
>
> see
>   public Object parseFacetOrStat(String key, String type, Object args)
> throws SyntaxError {
>     // TODO: a place to register all these facet types?
>
>     if ("field".equals(type) || "terms".equals(type)) {
>       return parseFieldFacet(key, args);
>     } else if ("query".equals(type)) {
>       return parseQueryFacet(key, args);
>     } else if ("range".equals(type)) {
>       return parseRangeFacet(key, args);
>     }
>
>
>
>
> On Thu, Oct 8, 2015 at 4:08 PM, Iana Bondarska <yana2...@gmail.com> wrote:
>
> > sorry,missed example input data:
> > child document:
> > { "c_gender": "female", "c_window": "seaview", "_root_": 1673891436 }
> >
> > parent document:
> > { "_id": 1673891436, "county_code": "26021", "city": "Auburn", "year":
> > 2012,
> > "county": "Berrien", "Sales": 112808, "state": "Washington",
> > "product_group":
> > "Books", "sku": "ZD111588", "income_bracket": "$25000 to $50000",
> > "_version_":
> > 1513636454494896000, "_root_": 1673891436 },
> >
> > 2015-10-08 15:00 GMT+03:00 Iana Bondarska <yana2...@gmail.com>:
> >
> > > Hello Mikhail,
> > >
> > > here are json.facet parameters that I tried:
> > > c_gender, c_window belong to child documents, rest - to parent.
> > >
> > > 1. returns no results, can we combine filters from different levels in
> > > queries
> > >
> > >  { high_popularity : {
> > >     type : query,
> > >     q : "{!child of=city:Auburn}city:Auburn AND c_window:seaview",
> > >     facet :{top_genres:{type: terms,field: c_gender}}
> > > }
> > > }
> > >
> > > 2.triggers full text search, I get error "undefined field:
> > > \"Review_Text\"" , that's true, I have mistake in configuration,but I
> > > didn't request fulltext search in the query
> > >
> > >  { high_popularity : {
> > >     type : query,
> > >     q : "{!child of=city:Auburn}city:Auburn AND {child
> > > of=state:Washingthon}state:Washingthon",
> > >     facet :{top_genres:{type: terms,field: c_gender}}
> > > }
> > > }
> > > logs for 2nd case:
> > >
> > > org.apache.solr.common.SolrException: undefined field: "Review_Text"
> > >       at
> > org.apache.solr.schema.IndexSchema.getField(IndexSchema.java:1229)
> > >       at
> >
> org.apache.solr.parser.SolrQueryParserBase.getRangeQuery(SolrQueryParserBase.java:769)
> > >       at org.apache.solr.parser.QueryParser.Term(QueryParser.java:382)
> > >       at
> org.apache.solr.parser.QueryParser.Clause(QueryParser.java:185)
> > >       at org.apache.solr.parser.QueryParser.Query(QueryParser.java:139)
> > >       at
> > org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:96)
> > >       at
> >
> org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:151)
> > >       at
> > org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:50)
> > >       at org.apache.solr.search.QParser.getQuery(QParser.java:141)
> > >       at
> >
> org.apache.solr.search.join.BlockJoinParentQParser.parse(BlockJoinParentQParser.java:70)
> > >       at
> >
> org.apache.solr.search.join.BlockJoinChildQParser.parse(BlockJoinChildQParser.java:25)
> > >       at org.apache.solr.search.QParser.getQuery(QParser.java:141)
> > >       at
> >
> org.apache.solr.search.facet.FacetQueryParser.parse(FacetRequest.java:473)
> > >       at
> >
> org.apache.solr.search.facet.FacetParser.parseQueryFacet(FacetRequest.java:255)
> > >       at
> >
> org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:238)
> > >       at
> >
> org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:229)
> > >       at
> > org.apache.solr.search.facet.FacetParser.parseSubs(FacetRequest.java:179)
> > >       at
> > org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:427)
> > >       at
> > org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:416)
> > >       at
> > org.apache.solr.search.facet.FacetModule.prepare(FacetModule.java:125)
> > >       at
> >
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:251)
> > >       at
> >
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> > >       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
> > >       at
> > org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:669)
> > >       at
> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:462)
> > >       at
> >
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:210)
> > >       at
> >
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)
> > >       at
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
> > >       at
> >
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
> > >       at
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> > >       at
> >
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
> > >       at
> >
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
> > >       at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
> > >       at
> > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
> > >       at
> >
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
> > >       at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
> > >       at
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> > >       at
> >
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
> > >       at
> >
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
> > >       at
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
> > >       at org.eclipse.jetty.server.Server.handle(Server.java:499)
> > >       at
> > org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
> > >       at
> >
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
> > >       at
> >
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
> > >       at
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
> > >       at
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
> > >       at java.lang.Thread.run(Thread.java:745)
> > >
> > >
> > > 2015-10-08 12:42 GMT+03:00 Mikhail Khludnev <
> mkhlud...@griddynamics.com
> > >:
> > >
> > >> Hello, Yana!
> > >>
> > >> It's not clear what happens. I appreciate if you put exact queries (up
> > to
> > >> obfuscated values) and exceptions or actual results (and
> expectations);
> > >> sample data is also useful.
> > >> What I can note so far, user filters can't be used as parent mask in
> > >> _which_ and _of_. See
> > >>
> > >>
> >
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
> > >> q={!parent which=<allParents>}<someChildren>. Again the parameter The
> > >> parameter allParents is a filter that matches only parent documents;
> > >>
> > >>
> > >>
> > >> On Thu, Oct 8, 2015 at 11:46 AM, Iana Bondarska <yana2...@gmail.com>
> > >> wrote:
> > >>
> > >> > Hello,
> > >> > I'm trying to use block join feature with json api. I got following
> > >> error
> > >> > when add query with  "which parent" or "child of " prefixes to query
> > >> facet.
> > >> > My query is :
> > >> >
> > >> > {!parent which="state:Idaho"} AND category:Books
> > >> >
> > >> > If I remove block-join prefixes -- query runs without errors. Are
> such
> > >> > filters supported by json api now?
> > >> >
> > >> > Best Regards,
> > >> > Iana
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Sincerely yours
> > >> Mikhail Khludnev
> > >> Principal Engineer,
> > >> Grid Dynamics
> > >>
> > >> <http://www.griddynamics.com>
> > >> <mkhlud...@griddynamics.com>
> > >>
> > >
> > >
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
> <mkhlud...@griddynamics.com>
>

Reply via email to