You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Yury Kats <yu...@yahoo.com> on 2012/02/22 18:25:46 UTC
Problem parsing queries with forward slashes and multiple fields
I'm running into a problem with queries that contain forward slashes and more than one field.
For example, these queries work fine:
fieldName:/a
fieldName:/*
But if I have two fields with similar syntax in the same query, it fails.
For simplicity, I'm using the same field twice:
fieldName:/a fieldName:/a
results in: "no field name specified in query and no defaultSearchField defined in schema.xml"
SEVERE: org.apache.solr.common.SolrException: no field name specified in query and no defaultSearchField defined in schema.xml
at org.apache.solr.search.SolrQueryParser.checkNullField(SolrQueryParser.java:106)
at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:124)
at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1058)
at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358)
at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257)
at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:212)
at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170)
at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:118)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:74)
at org.apache.solr.search.QParser.getQuery(QParser.java:143)
fieldName:/* fieldName:/*
results in: null
java.lang.NullPointerException
at org.apache.solr.schema.IndexSchema$DynamicReplacement.matches(IndexSchema.java:747)
at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1026)
at org.apache.solr.schema.IndexSchema.getFieldType(IndexSchema.java:980)
at org.apache.solr.search.SolrQueryParser.getWildcardQuery(SolrQueryParser.java:172)
at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1039)
at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358)
at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257)
at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:212)
at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170)
at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:118)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:74)
at org.apache.solr.search.QParser.getQuery(QParser.java:143)
Any ideas as to what may be wrong and how can I make these work?
I'm on a 4.0 snapshot from Nov 29, 2011.
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yury Kats <yu...@yahoo.com>.
On 2/22/2012 1:24 PM, Yonik Seeley wrote:
>> This is a bit puzzling as the forward slash is not part of the query language, is it?
>
> Regex queries were added that use forward slashes:
>
> https://issues.apache.org/jira/browse/LUCENE-2604
Oh, so / is a special character now? I don't think it is mentioned as such on any of the wiki pages,
or in org.apache.solr.client.solrj.util.ClientUtils
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yury Kats <yu...@yahoo.com>.
On 2/22/2012 1:24 PM, Yonik Seeley wrote:
>> Looks like escaping forward slashes makes the query work, eg
>> fieldName:\/a fieldName:\/a
>>
>> This is a bit puzzling as the forward slash is not part of the query language, is it?
>
> Regex queries were added that use forward slashes:
>
> https://issues.apache.org/jira/browse/LUCENE-2604
Looks like regex matching happens across multiple fields though. Feels like a bug to me?
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yonik Seeley <yo...@lucidimagination.com>.
2012/2/22 Yury Kats <yu...@yahoo.com>:
> On 2/22/2012 12:25 PM, Yury Kats wrote:
>> I'm running into a problem with queries that contain forward slashes and more than one field.
>>
>> For example, these queries work fine:
>> fieldName:/a
>> fieldName:/*
>>
>> But if I have two fields with similar syntax in the same query, it fails.
>>
>> For simplicity, I'm using the same field twice:
>>
>> fieldName:/a fieldName:/a
>
> Looks like escaping forward slashes makes the query work, eg
> fieldName:\/a fieldName:\/a
>
> This is a bit puzzling as the forward slash is not part of the query language, is it?
Regex queries were added that use forward slashes:
https://issues.apache.org/jira/browse/LUCENE-2604
-Yonik
lucidimagination.com
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yury Kats <yu...@yahoo.com>.
On 2/22/2012 12:25 PM, Yury Kats wrote:
> I'm running into a problem with queries that contain forward slashes and more than one field.
>
> For example, these queries work fine:
> fieldName:/a
> fieldName:/*
>
> But if I have two fields with similar syntax in the same query, it fails.
>
> For simplicity, I'm using the same field twice:
>
> fieldName:/a fieldName:/a
Looks like escaping forward slashes makes the query work, eg
fieldName:\/a fieldName:\/a
This is a bit puzzling as the forward slash is not part of the query language, is it?
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yury Kats <yu...@yahoo.com>.
On 2/22/2012 1:25 PM, Em wrote:
> That's strange.
>
> Could you provide a sample dataset?
Data set does not matter. The query fails to parse, long before it gets to the data.
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Em <ma...@yahoo.de>.
That's strange.
Could you provide a sample dataset?
I'd like to try it out.
Kind regards,
Em
Am 22.02.2012 19:17, schrieb Yury Kats:
> On 2/22/2012 1:05 PM, Em wrote:
>> Yury,
>>
>> are you sure your request has a proper url-encoding?
>
> Yes
>
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Yury Kats <yu...@yahoo.com>.
On 2/22/2012 1:05 PM, Em wrote:
> Yury,
>
> are you sure your request has a proper url-encoding?
Yes
Re: Problem parsing queries with forward slashes and multiple fields
Posted by Em <ma...@yahoo.de>.
Yury,
are you sure your request has a proper url-encoding?
Kind regards,
Em
Am 22.02.2012 18:25, schrieb Yury Kats:
> I'm running into a problem with queries that contain forward slashes and more than one field.
>
> For example, these queries work fine:
> fieldName:/a
> fieldName:/*
>
> But if I have two fields with similar syntax in the same query, it fails.
>
> For simplicity, I'm using the same field twice:
>
> fieldName:/a fieldName:/a
>
> results in: "no field name specified in query and no defaultSearchField defined in schema.xml"
>
> SEVERE: org.apache.solr.common.SolrException: no field name specified in query and no defaultSearchField defined in schema.xml
> at org.apache.solr.search.SolrQueryParser.checkNullField(SolrQueryParser.java:106)
> at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:124)
> at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1058)
> at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358)
> at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257)
> at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:212)
> at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170)
> at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:118)
> at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:74)
> at org.apache.solr.search.QParser.getQuery(QParser.java:143)
>
>
> fieldName:/* fieldName:/*
>
> results in: null
>
> java.lang.NullPointerException
> at org.apache.solr.schema.IndexSchema$DynamicReplacement.matches(IndexSchema.java:747)
> at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1026)
> at org.apache.solr.schema.IndexSchema.getFieldType(IndexSchema.java:980)
> at org.apache.solr.search.SolrQueryParser.getWildcardQuery(SolrQueryParser.java:172)
> at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1039)
> at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358)
> at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257)
> at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:212)
> at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170)
> at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:118)
> at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:74)
> at org.apache.solr.search.QParser.getQuery(QParser.java:143)
>
>
> Any ideas as to what may be wrong and how can I make these work?
>
> I'm on a 4.0 snapshot from Nov 29, 2011.
>