Re: Unable to finish sending updates
Hey Pavel, Were you able to resolve this issue? We are facing the similar behaviour on production cluster right now. Any insights are really appreciated. Thank you, Iana -- Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Solr Json API How to escape space in search string
Hi All, could you please tell me if escaping special characters in search keywords works in json api. e.g. I have document { "string_s":"new value" } And I want to query "string_s" field with keyword "new value". In path params api I can escape spaces in keyword as well as other special characters with \ . following query finds document: http://localhsot:8983/solr/dynamic_fields_qa/select?q=string_s:new\ value&wt=json&indent=true But if I try to run same search using json api, nothing is found: http://localhsot:8983/solr/dynamic_fields_qa/select?q=*:*&json= {"query":"string_s:new\ value"} Best Regards, Iana Bondarska
Solrj , how to create collection
Hi, Could you please tell me, is it possible to create new collection on solr server only using solrj,without manual creation of core folder on server. I'm using solrj v.5.5.0,standalone client. Thanks, Iana
Solrj: SystemInfoRequest fails if no default collection specified.
Hi All, I'm trying to get solr version via solrj api. If I try to use SystemInfoRequest without specifying collection -- I'm getting an error "No collection is set and no default collection specified". Could you tell me please, is there any way to get solr version without specifying collection? Thanks, Iana
Re: Solrj: SystemInfoRequest fails if no default collection specified.
yes, it's solr_cloud, version is 4.8. Solrj version is 5.4.1.sorry, yes, there are no systeminforequest, I'm sending new GenericSolrRequest(SolrRequest.METHOD.GET, "/admin/info/system", new MapSolrParams(ImmutableMap.of())) 2016-04-13 18:38 GMT+03:00 Shawn Heisey : > On 4/13/2016 9:01 AM, Iana Bondarska wrote: > > I'm trying to get solr version via solrj api. If I try to use > > SystemInfoRequest without specifying collection -- I'm getting an error > "No > > collection is set and no default collection specified". > > Could you tell me please, is there any way to get solr version without > > specifying collection? > > What version of Solr? What version of SolrJ? is it SolrCloud? Which > SolrClient implementation are you using? > > I do not see anything in the Solr source code named "SystemInfoRequest", > so it would probably be a good idea to share your .java file on the > Internet and provide a URL to reach it. > > Thanks, > Shawn > >
Solr json api,metrics calculation
Hi All, could you please help me with solr metrics on json api: 1) I don't see count metric in list of supported metrics -- is it really not supported now? E.g. I have records like this: city name NY johnson LA smith NYnull LA johnson. And I want to count of names grouped by city. Seems that for now there is only distinct count available 2) does average include null values? I checked old solr api -- it seems that it does not include nulls in average. But json api does. Is that a bug or they will work differently? Thanks, Iana
Local Params for Stats field
Hi, I'm trying to use localparams for stats component on Solr 4.4, exact query: q=*:*&core=hotel_reviews&collection=hotel_reviews&fq=checkout_date:[* TO *]&fq={!tag=period1}checkout_date:[2011-12-25T00:00:00.000Z TO 2012-01-02T00:00:00.000Z}&fq={!tag=period2}checkout_date:[2011-12-25T00:00:00.000Z TO 2012-01-02T00:00:00.000Z}&rows=0&stats=true&stats.field={!ex=period2}checkout_date and it fails with error "unknown field" checkout_date. Should localparams for stats field be supported for v. 4.4? If I run same query for v.4.8 -- it returns result w/o error Best Regards, Iana Bondarska
Error when use block-join filters in json api
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
Re: Error when use block-join filters in json api
l Khludnev : > 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=}. 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 > 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> > >
Re: Error when use block-join filters in json api
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 $5", "_version_": 1513636454494896000, "_root_": 1673891436 }, 2015-10-08 15:00 GMT+03:00 Iana Bondarska : > 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) >
Re: Error when use block-join filters in json api
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 : > > > > { 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 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 $5", > > "_version_": > > 1513636454494896000, "_root_": 1673891436 }, > > > > 2015-10-08 15:00 GMT+03:00 Iana Bondarska : > > > > > 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", > > > fa
FieldCache error for multivalued fields in json facets.
Hi, I'm using json query api for solr 5.2. When query for metrics for multivalued fields, I get error: can not use FieldCache on multivalued field: sales. I've found in solr wiki that to avoid using fieldcache I should set facet.method parameter to "enum". Now my question is how can I add facet.enum parameter to query? My original query looks like this: {"limit":0,"offset":0,"facet":{"facet":{"facet":{"mechanicnumbers_sum":"sum(sales)"},"limit":0,"field":"brand","type":"terms"}}} Adding method:enum inside facet doesn't help. Adding facet.method=enum outside json parameter also doesn't help. Best Regards, Iana
Re: FieldCache error for multivalued fields in json facets.
Yonik, Upayavira, thanks for response. Here is the stacktrace from solr logs. I can make my field single valued, but are there any plans to fix this or in general mulitvalued fields should not be used for metric calculation ? what about other metrics, e.g. avg, min,max -- should I be able to calculate them on multivalued fields? org.apache.solr.common.SolrException: can not use FieldCache on multivalued field: sales at org.apache.solr.schema.SchemaField.checkFieldCacheSource(SchemaField.java:187) at org.apache.solr.schema.TrieField.getValueSource(TrieField.java:236) at org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:378) at org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:235) at org.apache.solr.search.ValueSourceParser$79.parse(ValueSourceParser.java:832) at org.apache.solr.search.FunctionQParser.parseAgg(FunctionQParser.java:414) at org.apache.solr.search.facet.FacetParser.parseStringStat(FacetRequest.java:522) at org.apache.solr.search.facet.FacetParser.parseStringFacetOrStat(FacetRequest.java:515) at org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:449) at org.apache.solr.search.facet.FacetParser.parseSubs(FacetRequest.java:429) at org.apache.solr.search.facet.FacetFieldParser.parse(FacetRequest.java:728) at org.apache.solr.search.facet.FacetParser.parseFieldFacet(FacetRequest.java:500) at org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:486) at org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:479) at org.apache.solr.search.facet.FacetParser.parseSubs(FacetRequest.java:429) at org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:646) at org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:635) at org.apache.solr.search.facet.FacetModule.prepare(FacetModule.java:125) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:229) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143) at org.apache.solr.core.SolrCore.execute(SolrCore.java:2064) at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:654) at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:450) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:227) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:196) 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:497) 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-07-13 19:24 GMT+03:00 Yonik Seeley : > On Mon, Jul 13, 2015 at 1:55 AM, Iana Bondarska > wrote: > > Hi, > > I'm using json query api for solr 5.2. When query for metrics for > > multivalued fields, I get error: > > can not use FieldCache on multivalued field: sales. > > > > I've found in solr wiki that to avoid using fieldcache I should set > > facet.method parameter to "enum". > > Now my question is how can I add facet.enum parameter to query? > > My original query looks like this: > &g
Range Filter for Multi-Valued Date Fields
Hi All, could you help me please with multiple range filters on multi valued fields: I have following dataset: { "p_happyDates":[ "1986-05-16T20:00:00Z", "1875-04-29T21:57:56Z", "1906-07-04T21:57:56Z"] }, { "p_happyDates":[ "1986-05-16T20:00:00Z", "1975-10-31T21:57:56Z", "1966-12-28T21:00:00Z"] } I apply filters: &fq=(p_happyDates:[1975-10-31T00:00:00.000Z+TO+*]+AND+p_happyDates:[*+TO+1975-10-31T23:59:59.999Z]) I expect to see only second record. Actually I see both records. Even if I add parameter q.op=AND - result is the same. Is this expected behavior or known issue for multivalued fields? Best Regards, Iana Bondarska
Re: Range Filter for Multi-Valued Date Fields
Hello Mikhail, I convert filters that come from other part of application and in general cannot combine many filters into one , since conditions can be quite complex. Could you please provide more details why is this expected behavior - (p_happyDates:[1975-10-31T00:00:00.000Z+TO+*]+AND+p_ happyDates:[*+TO+1975-10-31T23:59:59.999Z]) is AND filter with 2 conditions date>="1975-10-31T00:00:00.000Z" and date<="1975-10- 31T23:59:59.999Z" , seems that it should return same results that &fq=p_happyDates:[1975-10-31T00:00:00.000Z+TO+1975-10-31T23:59:59.999Z] 2016-08-23 15:00 GMT+03:00 Mikhail Khludnev : > Hello Iana, > > I consider is as expected behavior, perhaps usually it's done as > &fq=p_happyDates:[1975-10-31T00:00:00.000Z+TO+1975-10-31T23:59:59.999Z], > which is not equivalent to combining half closed ranges with boolean query. > I wonder why did you do like that? > > On Tue, Aug 23, 2016 at 2:33 PM, Iana Bondarska > wrote: > > > Hi All, > > > > could you help me please with multiple range filters on multi valued > > fields: > > I have following dataset: > > { > > "p_happyDates":[ > > "1986-05-16T20:00:00Z", > > "1875-04-29T21:57:56Z", > > "1906-07-04T21:57:56Z"] > > }, > > { > > "p_happyDates":[ > > "1986-05-16T20:00:00Z", > > "1975-10-31T21:57:56Z", > > "1966-12-28T21:00:00Z"] > > } > > I apply filters: > > &fq=(p_happyDates:[1975-10-31T00:00:00.000Z+TO+*]+AND+p_ > > happyDates:[*+TO+1975-10-31T23:59:59.999Z]) > > I expect to see only second record. > > Actually I see both records. Even if I add parameter q.op=AND - result is > > the same. > > Is this expected behavior or known issue for multivalued fields? > > > > Best Regards, > > Iana Bondarska > > > > > > -- > Sincerely yours > Mikhail Khludnev >
Re: Range Filter for Multi-Valued Date Fields
thank for explanation, seems that between isn't equivalent to 2 range filters for multivalued fields. 2016-08-24 8:19 GMT+03:00 Mikhail Khludnev : > It executes both half closed ranges first, here the undesired first doc > comes in. Then it intersect these document sets, and here again, the > undesired first doc comes through. > > On Tue, Aug 23, 2016 at 5:15 PM, Iana Bondarska > wrote: > > > Hello Mikhail, > > I convert filters that come from other part of application and in general > > cannot combine many filters into one , since conditions can be quite > > complex. > > Could you please provide more details why is this expected behavior - > > (p_happyDates:[1975-10-31T00:00:00.000Z+TO+*]+AND+p_ > > happyDates:[*+TO+1975-10-31T23:59:59.999Z]) is AND filter with 2 > > conditions date>="1975-10-31T00:00:00.000Z" and date<="1975-10- > > 31T23:59:59.999Z" , seems that it should return same results that > > &fq=p_happyDates:[1975-10-31T00:00:00.000Z+TO+1975-10-31T23:59:59.999Z] > > > > > > > > 2016-08-23 15:00 GMT+03:00 Mikhail Khludnev : > > > > > Hello Iana, > > > > > > I consider is as expected behavior, perhaps usually it's done as > > > &fq=p_happyDates:[1975-10-31T00:00:00.000Z+TO+1975-10- > 31T23:59:59.999Z], > > > which is not equivalent to combining half closed ranges with boolean > > query. > > > I wonder why did you do like that? > > > > > > On Tue, Aug 23, 2016 at 2:33 PM, Iana Bondarska > > > wrote: > > > > > > > Hi All, > > > > > > > > could you help me please with multiple range filters on multi valued > > > > fields: > > > > I have following dataset: > > > > { > > > > "p_happyDates":[ > > > > "1986-05-16T20:00:00Z", > > > > "1875-04-29T21:57:56Z", > > > > "1906-07-04T21:57:56Z"] > > > > }, > > > > { > > > > "p_happyDates":[ > > > > "1986-05-16T20:00:00Z", > > > > "1975-10-31T21:57:56Z", > > > > "1966-12-28T21:00:00Z"] > > > > } > > > > I apply filters: > > > > &fq=(p_happyDates:[1975-10-31T00:00:00.000Z+TO+*]+AND+p_ > > > > happyDates:[*+TO+1975-10-31T23:59:59.999Z]) > > > > I expect to see only second record. > > > > Actually I see both records. Even if I add parameter q.op=AND - > result > > is > > > > the same. > > > > Is this expected behavior or known issue for multivalued fields? > > > > > > > > Best Regards, > > > > Iana Bondarska > > > > > > > > > > > > > > > > -- > > > Sincerely yours > > > Mikhail Khludnev > > > > > > > > > -- > Sincerely yours > Mikhail Khludnev >
Using custom user-defined caches to store user app data while indexing
Hi, I'm trying to implement a custom UpdateRequestProcessorFactory class that works with the XSLT Request handler for indexing. My UpdateRequestProcessorFactory has to examine some of the document fields and compare them against some regular expressions that are stored in an external MySQL database. Currently, my UpdateRequestProcessorFactory works by establishing a connection to the database and them retrieving the regular expressions for every new document that needs to be indexed. However, I would like to speed up this processing and store the regular expressions in memory. I tried to define a new user cache in solrconfig.xml (http://wiki.apache.org/solr/SolrCaching#User.2BAC8-Generic_Caches). As far as I understand, these caches can be used to store any user application data. But when I implement the UpdateRequestProcessorFactory, I do not arrive to access this cache. What would be the method to read/write into a user defined sorl cache while indexing? How can I access the current SolrIndexSearcher from my code? Are there any other solutions that I should look at? Thanks! Iana
Non-exists Field Query doesn't work when use defType=edismax
Hi everyone, I'm checking Solr query that contains condition "Exclude all documents that contain ceratin field". Currently, it looks like this: *(*:* AND -field_to_exclude:*)* Full query is: *((some_other_field:"value") AND ((*:* AND -field_to_exclude:*)))* If I use defType=edismax, nothing is found. If I use default defType - I get correct results, same as when I do not specify *:* in non-exists condition. My questions are: 1) why defType "edismax" leads to empty results? 2) do we really need to include clause "**:**" in non-exists condition? Isn't *-field_to_exclude:* *enough? -- Best Regards, Iana Bondarska
Re: Non-exists Field Query doesn't work when use defType=edismax
Hi Erick, thanks for the response! I've checked parsed queries in debug mode and there is following difference: original query(this is value of the q parameter in the query) : (some_field:"hourly") AND (*:* AND -field_to_exclude:*) for edismax defType: (+(+(+some_field:hourly) +(+DisjunctionMaxQuery((doc_text_value:*\\:*)) -field_to_exclude:*)))/no_coord for default defType: +(+some_field:hourly) +(+MatchAllDocsQuery(*:*) -field_to_exclude:*) defType: How comes that edisMax defType parses *:* query as (doc_text_value:*\\:*)? What should I use instead? Also you've mentioned that field_to_exclude:* is inefficient when use in fq. Does it work the same if I use this clause in q? On Fri, Sep 11, 2020 at 9:18 PM Erick Erickson wrote: > First, Solr does _not_ implement boolean logic. It can look like it, but > that’s sugar. > See: https://lucidworks.com/post/why-not-and-or-and-not/ > > As for (1), I haven’t a clue. If you’d provided the results of > adding &debug=query to the query, the parsed version > would have given us some pointers. > > (2) Yes, See the reference above. the NOT (-) operator is really > “from the results so far, remove everything that satisfies this clause”. > But just -field_to_exclude:[* TO *] has nothing to remove > things that satisfy this clause _from_. > > > And a couple of nits: > There’s no need for the AND, again, see the reference above. > ((*:* -field_to_exclude:*)) would work just fine. > > Second, and just to confuse you, the *:* is not required in fq > clauses, there’s some special logic to handle > fq=-field_to_exclude:* > that implies the *:* that you’d have to put in a “q” clause. > > Third, field_to_exclude:* is actually fairly inefficient, > fq=-field_to_exclude:[* TO *] > can be more efficient. The reasons are rather arcane... > > Best, > Erick > > > On Sep 11, 2020, at 10:18 AM, Iana Bondarska wrote: > > > > Hi everyone, > > I'm checking Solr query that contains condition "Exclude all documents > that > > contain ceratin field". > > Currently, it looks like this: > > *(*:* AND -field_to_exclude:*)* > > > > Full query is: > > *((some_other_field:"value") AND ((*:* AND -field_to_exclude:*)))* > > > > If I use defType=edismax, nothing is found. If I use default defType - I > > get correct results, same as when I do not specify *:* in non-exists > > condition. > > > > My questions are: > > 1) why defType "edismax" leads to empty results? > > 2) do we really need to include clause "**:**" in non-exists condition? > > Isn't *-field_to_exclude:* *enough? > > -- > > Best Regards, > > Iana Bondarska > > -- Best Regards, Iana Bondarska