On Mar 31, 2009, at 2:13 PM, Development Team wrote:
On the Lucene query parser syntax page (
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html) linked
to from
the Solr query syntax page, they mention:
"If you are programmatically generating a query string and then
parsing it
with the query parser then you should seriously consider building your
queries directly with the query API. In other words, the query
parser is
designed for human-entered text, not for program-generated text."
What do they mean by "using the API"? If I use SolrJ to construct a
SolrQuery, doesn't that get processed by the query parser? How do I
bypass
the query parser to set up a query directly?
Especially for token-values (values that fit a defined set, such as
Enum
values), it seems silly for me to continually be appending,
"+tokenField:(1,
2, 3)" to my query. Why should I write code to construct the query
string,
then send this to the parser to parse the string into an object?
Can't I set
these query parameters directly? If so, how?
Without a custom QParser implementation, there is no way to avoid the
string concatenation -> parser step, even using SolrJ. The bit you
refer to in the Lucene query parser documentation is at the Lucene API
level, which is only accessible via QParser plugins, not by a Solr
client API.
Erik