You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2009/04/04 02:22:09 UTC
[Solr Wiki] Update of "SolrQuerySyntax" by HossMan
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by HossMan:
http://wiki.apache.org/solr/SolrQuerySyntax
The comment on the change is:
restructure to move QParser explanation to the intro section
------------------------------------------------------------------------------
- = Solr Query Syntax =
+ Solr supports multiple query syntaxes through its query parser plugin framework.
+ For documentation on the full list of available parser types, see the all subclasses of
+ [http://lucene.apache.org/solr/api/org/apache/solr/search/QParserPlugin.html QParserPlugin] in the javadoc.
+
+ [[TableOfContents()]]
+
+ = Specifying a Query Parser =
+
+ Users can specify the type of a query in most places that accept a query string using LocalParams syntax.
+ For example, the following query string specifies a lucene/solr query with a default operator of "AND" and a default field of "text":
+ {{{q={!lucene q.op=AND df=text}myfield:foo +bar -baz}}}
+
+ In standard Solr search handlers, the default type of the main query only may be specified via the {{{defType}}} parameter. The default type of all other query parameters will remain "[#lucene lucene]".
+
+ {{{q={!func}popularity}}}
+ is thus equivalent to
+ {{{defType=func&q=popularity}}}
+ in the standard Solr search handler.
+
+ [[Anchor(lucene)]]
+ = Default QParserPlugin: LuceneQParserPlugin =
The standard Solr Query Parser syntax is a superset of the [http://lucene.apache.org/java/2_4_0/queryparsersyntax.html Lucene Query Parser syntax].
@@ -31, +51 @@
* {{{createdate:[1976-03-06T23:59:59.999Z TO 1976-03-06T23:59:59.999Z+1YEAR]}}}
* {{{createdate:[1976-03-06T23:59:59.999Z/YEAR TO 1976-03-06T23:59:59.999Z]}}}
- == Query Parser plugins ==
- Solr supports multiple query syntaxes through its query parser plugin framework.
- For documentation on the full list of available parser types, see the all subclasses of
- [http://lucene.apache.org/solr/api/org/apache/solr/search/QParserPlugin.html QParserPlugin] in the javadoc.
-
- Users can specify the type of a query in most places that accept a query string using LocalParams syntax.
- For example, the following query string specifies a lucene/solr query with a default operator of "AND" and a default field of "text":
- {{{q={!lucene q.op=AND df=text}myfield:foo +bar -baz}}}
-
- In standard Solr search handlers, the default type of the main query only may be specified via the {{{defType}}} parameter. The default type of all other query parameters will remain "lucene".
- {{{q={!func}popularity}}}
- is thus equivalent to
- {{{defType=func&q=popularity}}}
- in the standard Solr search handler.
-
[[Anchor(urlescaping)]]
- == URL Escaping Special Characters ==
+ = NOTE: URL Escaping Special Characters =
Please note that many characters in the Solr Query Syntax (most notable the plus sign: "`+`") are special characters in URLs, so when constructing request URLs manually, you must properly URL-Encode these characters.
{{{
q= +popularity:[10 TO *] +section:0
http://localhost:8983/solr/select?q=%2Bpopularity:[10%20TO%20*]%20%2Bsection:0
}}}
-