What is wrong with this blank query?
http://localhost:8983/solr/doc1/select?q=text:()debugQuery=ondefType=lucene I get this error: org.apache.solr.search.SyntaxError: Cannot parse 'text:()': Encountered ) ) at line 1, column 6. Was expecting one of: NOT ... + ... - ... BAREOPER ... ( ... * ... QUOTED ... TERM ... PREFIXTERM ... WILDTERM ... REGEXPTERM ... [ ... { ... LPARAMS ... NUMBER ... TERM ... * ... Why does lucene query parser support blank field? I know the work around is -text:[* TO *] But I like text:() as it is more logical. Is there any reason? Thanks -Shankar
Re: Can anyone explain this Solr query behavior?
Hi Upayavira, Thank you for your analysis. I thought 'AND' groupings are supported as per documentation: http://docs.lucidworks.com/display/solr/The+Extended+DisMax+Query+Parser http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html#Grouping But yes, q=doc-id:3000 AND (-text:[* TO *]) works as expected. Thanks -Shankar On Thu, May 23, 2013 at 5:31 PM, Upayavira u...@odoko.co.uk wrote: (+(doc-id:3000 DisjunctionMaxQuery((Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0/no_coord You're using edismax, not lucene. So AND is being considered as a search term, not an operator, and the word 'and' probably exists in 631580 documents. Why is it triggering dismax? Probably because field:() is not valid syntax, so edismax is dropping to dismax because it isn't a valid lucene query. What do you expect text:() to do? If you want to match any docs that have a value in the text field, use q=text:[* TO *] To match docs that *don't* have a value in the text field: q=-text[* TO *] Upayavira On Fri, May 24, 2013, at 12:23 AM, Shankar Sundararaju wrote: Hi Erick, Here's the output after turning on the debug flag: *q=text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=indenttrue/str str name=qtext:()/str str name=debugquery/str /lst /lst result name=response numFound=0 start=0 maxScore=0.0/result lst name=debug str name=rawquerystringtext:()/str str name=querystringtext:()/str str name=parsedquery(+())/no_coord/str str name=parsedquery_toString+()/str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=qdoc-id:3000/str str name=debugquery/str /lst /lst result name=response numFound=1 start=0 maxScore=11.682044 doc : : /doc /result lst name=debug str name=rawquerystringdoc-id:3000/str str name=querystringdoc-id:3000/str str name=parsedquery(+doc-id:3000)/no_coord/str str name=parsedquery_toString+doc-id:`#8;#0;#0;#23;8/str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000 AND text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime23/int lst name=params str name=qdoc-id:3000 AND text:()/str str name=debugquery/str /lst /lst result name=response numFound=631647 start=0 maxScore=8.056607 doc : /doc : /doc doc : /doc doc : /doc doc : /doc doc : /doc /result lst name=debug str name=rawquerystringdoc-id:3000 AND text:()/str str name=querystringdoc-id:3000 AND text:()/str str name=parsedquery (+(doc-id:3000 DisjunctionMaxQuery((Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0/no_coord /str str name=parsedquery_toString +(doc-id:`#8;#0;#0;#23;8 (Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0)) /str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *solrconfig.xml:* requestHandler name=/select class=solr.SearchHandler lst name=defaults str name=echoParamsexplicit/str int name=rows10/int str name=dftext/str str name=defTypeedismax/str str name=qftext^1.0 Title^3.0 Classification^2.0 Contributors^2.0 Publisher^2.0/str /lst *schema.xml:* field name=text type=my_text indexed=true stored=false required= false/* * dynamicField name=* type=my_text indexed=true stored=true multiValued=false/ fieldType name=my_text class=solr.TextField analyzer type=index class=MyAnalyzer/ analyzer type=query class=MyAnalyzer/ analyzer type=multiterm class=MyAnalyzer/ /fieldType * * *Note:* MyAnalyzer among few other customizations, uses WhitespaceTokenizer and LoweCaseFilter Thanks a lot. -Shankar On Thu, May 23, 2013 at 4:34 AM, Erick Erickson erickerick...@gmail.comwrote: Please post the results of adding debug=query to the URL. That'll tell us what the query parser spits out which is much easier to analyze. Best Erick On Wed, May 22, 2013 at 12:16 PM, Shankar Sundararaju shan...@ebrary.com wrote: This query returns 0 documents: *q=(+Title:() +Classification:() +Contributors:() +text:())* This returns 1 document: *q=doc-id:3000* And this returns 631580 documents
Re: Can anyone explain this Solr query behavior?
Hi Jack Krupansky, Thank you for your reply. I would like to know how you got the error logging? Is there any special flag I have to turn on? Because I don't see it in my solr.log even after switching the log level to DEBUG. str name=msgorg.apache.solr.**search.SyntaxError: Cannot parse 'id:* AND text:()': Encountered ) ) at line 1, column 15. Thanks -Shankar On Thu, May 23, 2013 at 5:41 PM, Jack Krupansky j...@basetechnology.comwrote: Okay... sorry I wasn't paying close enough attention. What is happening is that the empty parentheses are illegal in Lucene query syntax: str name=msgorg.apache.solr.**search.SyntaxError: Cannot parse 'id:* AND text:()': Encountered ) ) at line 1, column 15. Was expecting one of: lt;NOTgt; ... + ... - ... lt;BAREOPERgt; ... ( ... * ... lt;QUOTEDgt; ... lt;TERMgt; ... lt;PREFIXTERMgt; ... lt;WILDTERMgt; ... lt;REGEXPTERMgt; ... [ ... { ... lt;LPARAMSgt; ... lt;NUMBERgt; ... lt;TERMgt; ... * ... /str int name=code400/int Edismax traps such errors and then escapes the query so that Lucene will no longer throw an error. In this case, it puts quotes around the AND operator, which is why you see and included in the parsed query as if it were a term. And I believe it turns text:() into text:(), which makes the original Lucene error go away, but the () analyzes to nothing and generates no term in the query. So, fix your syntax error and the anomaly should go away. -- Jack Krupansky -Original Message- From: Shankar Sundararaju Sent: Thursday, May 23, 2013 7:23 PM To: solr-user@lucene.apache.org Subject: Re: Can anyone explain this Solr query behavior? Hi Erick, Here's the output after turning on the debug flag: *q=text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=indenttrue/str str name=qtext:()/str str name=debugquery/str /lst /lst result name=response numFound=0 start=0 maxScore=0.0/result lst name=debug str name=rawquerystringtext:()**/str str name=querystringtext:()/**str str name=parsedquery(+())/no_**coord/str str name=parsedquery_toString+(**)/str str name=QParser**ExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=qdoc-id:3000/str str name=debugquery/str /lst /lst result name=response numFound=1 start=0 maxScore=11.682044 doc : : /doc /result lst name=debug str name=rawquerystringdoc-id:**3000/str str name=querystringdoc-id:**3000/str str name=parsedquery(+doc-id:**3000)/no_coord/str str name=parsedquery_toString+**doc-id:`#8;#0;#0;#23;8/str str name=QParser**ExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000 AND text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime23/int lst name=params str name=qdoc-id:3000 AND text:()/str str name=debugquery/str /lst /lst result name=response numFound=631647 start=0 maxScore=8.056607 doc : /doc : /doc doc : /doc doc : /doc doc : /doc doc : /doc /result lst name=debug str name=rawquerystringdoc-id:**3000 AND text:()/str str name=querystringdoc-id:3000 AND text:()/str str name=parsedquery (+(doc-id:3000 DisjunctionMaxQuery((**Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0/no_coord /str str name=parsedquery_toString +(doc-id:`#8;#0;#0;#23;8 (Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0)) /str str name=QParser**ExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *solrconfig.xml:* requestHandler name=/select class=solr.SearchHandler lst name=defaults str name=echoParamsexplicit/**str int name=rows10/int str name=dftext/str str name=defTypeedismax/str str name=qftext^1.0 Title^3.0 Classification^2.0 Contributors^2.0 Publisher^2.0/str /lst *schema.xml:* field name=text type=my_text indexed=true stored=false required= false/* * dynamicField name=* type=my_text indexed=true stored=true multiValued=false/ fieldType name=my_text class=solr.TextField analyzer type=index class=MyAnalyzer/ analyzer type=query class=MyAnalyzer/ analyzer type=multiterm class=MyAnalyzer/ /fieldType * * *Note:* MyAnalyzer among few other customizations, uses WhitespaceTokenizer and LoweCaseFilter Thanks a lot. -Shankar On Thu, May 23, 2013 at 4:34 AM, Erick Erickson erickerick...@gmail.com* *wrote: Please post the results
Re: Can anyone explain this Solr query behavior?
Hi Erick, Here's the output after turning on the debug flag: *q=text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=indenttrue/str str name=qtext:()/str str name=debugquery/str /lst /lst result name=response numFound=0 start=0 maxScore=0.0/result lst name=debug str name=rawquerystringtext:()/str str name=querystringtext:()/str str name=parsedquery(+())/no_coord/str str name=parsedquery_toString+()/str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime17/int lst name=params str name=qdoc-id:3000/str str name=debugquery/str /lst /lst result name=response numFound=1 start=0 maxScore=11.682044 doc : : /doc /result lst name=debug str name=rawquerystringdoc-id:3000/str str name=querystringdoc-id:3000/str str name=parsedquery(+doc-id:3000)/no_coord/str str name=parsedquery_toString+doc-id:`#8;#0;#0;#23;8/str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *q=doc-id:3000 AND text:()debug=query* yields response lst name=responseHeader int name=status0/int int name=QTime23/int lst name=params str name=qdoc-id:3000 AND text:()/str str name=debugquery/str /lst /lst result name=response numFound=631647 start=0 maxScore=8.056607 doc : /doc : /doc doc : /doc doc : /doc doc : /doc doc : /doc /result lst name=debug str name=rawquerystringdoc-id:3000 AND text:()/str str name=querystringdoc-id:3000 AND text:()/str str name=parsedquery (+(doc-id:3000 DisjunctionMaxQuery((Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0/no_coord /str str name=parsedquery_toString +(doc-id:`#8;#0;#0;#23;8 (Publisher:and^2.0 | text:and | Classification:and^2.0 | Contributors:and^2.0 | Title:and^3.0)) /str str name=QParserExtendedDismaxQParser/str null name=altquerystring/ null name=boost_queries/ arr name=parsed_boost_queries/ null name=boostfuncs/ /lst /response *solrconfig.xml:* requestHandler name=/select class=solr.SearchHandler lst name=defaults str name=echoParamsexplicit/str int name=rows10/int str name=dftext/str str name=defTypeedismax/str str name=qftext^1.0 Title^3.0 Classification^2.0 Contributors^2.0 Publisher^2.0/str /lst *schema.xml:* field name=text type=my_text indexed=true stored=false required= false/* * dynamicField name=* type=my_text indexed=true stored=true multiValued=false/ fieldType name=my_text class=solr.TextField analyzer type=index class=MyAnalyzer/ analyzer type=query class=MyAnalyzer/ analyzer type=multiterm class=MyAnalyzer/ /fieldType * * *Note:* MyAnalyzer among few other customizations, uses WhitespaceTokenizer and LoweCaseFilter Thanks a lot. -Shankar On Thu, May 23, 2013 at 4:34 AM, Erick Erickson erickerick...@gmail.comwrote: Please post the results of adding debug=query to the URL. That'll tell us what the query parser spits out which is much easier to analyze. Best Erick On Wed, May 22, 2013 at 12:16 PM, Shankar Sundararaju shan...@ebrary.com wrote: This query returns 0 documents: *q=(+Title:() +Classification:() +Contributors:() +text:())* This returns 1 document: *q=doc-id:3000* And this returns 631580 documents when I was expecting 0: *q=doc-id:3000 AND (+Title:() +Classification:() +Contributors:() +text:())* Am I missing something here? Can someone please explain? I am using Solr 4.2.1 Thanks -Shankar -- Regards, *Shankar Sundararaju *Sr. Software Architect ebrary, a ProQuest company 410 Cambridge Avenue, Palo Alto, CA 94306 USA shan...@ebrary.com | www.ebrary.com | 650-475-8776 (w) | 408-426-3057 (c)
Can anyone explain this Solr query behavior?
This query returns 0 documents: *q=(+Title:() +Classification:() +Contributors:() +text:())* This returns 1 document: *q=doc-id:3000* And this returns 631580 documents when I was expecting 0: *q=doc-id:3000 AND (+Title:() +Classification:() +Contributors:() +text:())* Am I missing something here? Can someone please explain? I am using Solr 4.2.1 Thanks -Shankar
Re: solr 4.1 - trying to create 2 collection with 2 different sets of configurations
You may also have to link the config name with collection name in the zookeeper. Here's the command to do it: cloud-scripts/zkcli.sh -cmd linkconfig -zkhost localhost:9983 -collection COLLECTION_1_NAME -confname CONF_1_NAME Rafal, did having the config name same as collection name allow you to create collections without having to link the corresponding config names? I did not try this myself. Thanks -Shankar On Thu, Feb 28, 2013 at 4:41 AM, Rafał Kuć r@solr.pl wrote: Hello! You can try doing the following: 1. Run Solr with no collection and no cores, just an empty solr.xml 2. If you don't have a ZooKeeper run Solr with -DzkRun 3. Upload you configurations to ZooKeeper, by running cloud-scripts/zkcli.sh -cmdupconfig -zkhost localhost:9983 -confdir CONFIGURATION_1_DIR -confname COLLECTION_1_NAME and cloud-scripts/zkcli.sh -cmdupconfig -zkhost localhost:9983 -confdir CONFIGURATION_2_DIR -confname COLLECTION_2_NAME 4. Create those two collections: curl ' http://localhost:8983/solr/admin/collections?action=CREATEname=COLLECTION_1_NAMEnumShards=2replicationFactor=0 ' and curl ' http://localhost:8983/solr/admin/collections?action=CREATEname=COLLECTION_2_NAMEnumShards=2replicationFactor=0 ' Of course the CONFIGURATION_1_DIR and CONFIGURATION_2_DIR is the directory where your configurations are stored and the COLLECTION_1_NAME and the COLLECTION_2_NAME are your collection names. Also adjust the numShards and replicationFactor to your needs. -- Regards, Rafał Kuć Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch solr 4.1 - trying to create 2 collection with 2 different sets of configurations. Anyone accomplished this? if I run bootstraop twice on different conf dirs, I get both of them in zookeper, but using collections API to create a collection if collection.configName=seconfConf doesnt work. any idea? thanks. -- View this message in context: http://lucene.472066.n3.nabble.com/solr-4-1-trying-to-create-2-collection-with-2-different-sets-of-configurations-tp4043609.html Sent from the Solr - User mailing list archive at Nabble.com. -- Regards, *Shankar Sundararaju *Sr. Software Architect ebrary, a ProQuest company 410 Cambridge Avenue, Palo Alto, CA 94306 USA shan...@ebrary.com | www.ebrary.com | 650-475-8776 (w) | 408-426-3057 (c)
Re: How do I create two collections on the same cluster?
Thank you Shawn. Neither using ip address nor maxShardsPerNode=1 has any effect. Let me try few other things today and I'll get back to you. -Shankar On Thu, Feb 21, 2013 at 9:05 PM, Shawn Heisey s...@elyograg.org wrote: On 2/21/2013 9:50 PM, Shankar Sundararaju wrote: I am using Solr 4.1. I created collection1 consisting of 2 leaders and 2 replicas (2 shards) at boot time. After the cluster is up, I am trying to create collection2 with 2 leaders and 2 replicas just like collection1. I am using following collections API for that: http://localhost:7575/solr/**admin/collections?action=** CREATEname=collection2**numShards=2replicationFactor=** 2collection.configName=**myconfcreateNodeSet=** localhost:8983_solr,localhost:**7574_solr,localhost:7575_solr,** localhost:7576_solrhttp://localhost:7575/solr/admin/collections?action=CREATEname=collection2numShards=2replicationFactor=2collection.configName=myconfcreateNodeSet=localhost:8983_solr,localhost:7574_solr,localhost:7575_solr,localhost:7576_solr Yes, collection2 does get created. But I see a problem - createNodeSet parameter is not being honored. All 4 nodes are not being used to create collection2, only 3 are being used. Is this a bug or I don't understand how this parameter should be used? What is the best way to create collection2? Can I specify both collections in solr.xml in the solr home dir in all nodes and launch them? Do I have to get the configs for collection2 uploaded to zookeeper before I launch the nodes? Is your cluster comprised of only those four Solr nodes, or do you have others? If it's just those four, you should not need to tell it which ones to use, it should use all of them. You could try adding maxShardsPerNode=1 just to be sure that it won't try to put more than one shard on any one node. I did find an email thread saying that hostnames won't work in createNodeSet with Solr 4.1, because 4.1 defaults to IP addresses when each node registers with Zookeeper. Check your SolrCloud graph in the admin UI. If you see IP addresses there, you will probably have to use IP addresses in the createNodeSet parameter. You can force hostnames by including host=myhostname in the cores parameter of solr.xml and restarting Solr on that node. I'm relatively new to SolrCloud, but I'm learning. Thanks, Shawn -- Regards, *Shankar Sundararaju *Sr. Software Architect ebrary, a ProQuest company 410 Cambridge Avenue, Palo Alto, CA 94306 USA shan...@ebrary.com | www.ebrary.com | 650-475-8776 (w) | 408-426-3057 (c)
How do I create two collections on the same cluster?
I am using Solr 4.1. I created collection1 consisting of 2 leaders and 2 replicas (2 shards) at boot time. After the cluster is up, I am trying to create collection2 with 2 leaders and 2 replicas just like collection1. I am using following collections API for that: http://localhost:7575/solr/admin/collections?action=CREATEname=collection2numShards=2replicationFactor=2collection.configName=myconfcreateNodeSet=localhost:8983_solr,localhost:7574_solr,localhost:7575_solr,localhost:7576_solr Yes, collection2 does get created. But I see a problem - createNodeSet parameter is not being honored. All 4 nodes are not being used to create collection2, only 3 are being used. Is this a bug or I don't understand how this parameter should be used? What is the best way to create collection2? Can I specify both collections in solr.xml in the solr home dir in all nodes and launch them? Do I have to get the configs for collection2 uploaded to zookeeper before I launch the nodes? Thanks in advance. -Shankar -- Regards, *Shankar Sundararaju *Sr. Software Architect ebrary, a ProQuest company 410 Cambridge Avenue, Palo Alto, CA 94306 USA shan...@ebrary.com | www.ebrary.com | 650-475-8776 (w) | 408-426-3057 (c)
Parallel indexing and swapping
Hi All, I am using Solr 4.1. I have a Solr cluster of 3 leaders and 3 replicas hosting collection1 consisting of thousands of documents currently serving the search requests. I would like re-index all the documents in another collection, say collection2 in this same solr cluster and swap it with collection1. I would think this is a very common use case - we don't want any service interruption to our customer's search requests. So, can someone list the steps and commands involved to achieve the above? I did take a look at collection API. Should collection2 have exact same configurations as collection1, I mean number of leaders and replicas? How do I swap a collection? There does not seem to be any API for that. From admin GUI, I can only swap individual cores. This is not good - I would like to know if there is any atomic way to swap an entire collection. Another problem is - collections API does not seem to give me control over where each leaders and replicas will be created for the new collection in the cluster. Unless I have a control over this, how am I going to swap if I *have* to use only core swapping feature. I did check out other email threads on this topic, but none seems to be very clear. Thanks a lot for your help. -Shankar