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 Jason Toy <ja...@gmail.com> on 2011/08/26 20:27:11 UTC
syntax for functions used in the fq parameter
I'm trying to limit my data to only docs that have the word 'foo' appear at
least once.
I am trying to use:
fq=termfreqdata,'foo'):[1+TO+*]
but I get the syntax error:
Caused by: org.apache.lucene.queryparser.classic.ParseException: Encountered
" ":" ": "" at line 1, column 33.
Was expecting one of:
<EOF>
<AND> ...
<OR> ...
<NOT> ...
"+" ...
"-" ...
<BAREOPER> ...
"(" ...
"*" ...
"^" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
<REGEXPTERM> ...
"[" ...
"{" ...
<NUMBER> ...
at
org.apache.lucene.queryparser.classic.QueryParser.generateParseException(QueryParser.java:708)
at
org.apache.lucene.queryparser.classic.QueryParser.jj_consume_token(QueryParser.java:590)
at
org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:171)
at
org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:119)
... 25 more
What is the proper way to do this?
Re: syntax for functions used in the fq parameter
Posted by Chris Hostetter <ho...@fucit.org>.
: Why doesn't " AND text:foo" fill this requirement?
or fq=text:foo (if you don't want it to affect scoring, and it sounds
like you don't)
But since you asked: if you want to use functions in "fq" you have to tell
solr to parse it as a function. There are a variaty of options...
https://wiki.apache.org/solr/FunctionQuery#Using_FunctionQuery
...but for an "fq" you'll probably want to use the "frange" QParser (since
your goal is to limit matches based on the value of a function)...
https://lucene.apache.org/solr/api/org/apache/solr/search/FunctionRangeQParserPlugin.html
-Hoss
Re: syntax for functions used in the fq parameter
Posted by Erick Erickson <er...@gmail.com>.
Why doesn't " AND text:foo" fill this requirement?
Best
Erick
On Fri, Aug 26, 2011 at 2:27 PM, Jason Toy <ja...@gmail.com> wrote:
> I'm trying to limit my data to only docs that have the word 'foo' appear at
> least once.
> I am trying to use:
> fq=termfreqdata,'foo'):[1+TO+*]
>
> but I get the syntax error:
> Caused by: org.apache.lucene.queryparser.classic.ParseException: Encountered
> " ":" ": "" at line 1, column 33.
> Was expecting one of:
> <EOF>
> <AND> ...
> <OR> ...
> <NOT> ...
> "+" ...
> "-" ...
> <BAREOPER> ...
> "(" ...
> "*" ...
> "^" ...
> <QUOTED> ...
> <TERM> ...
> <PREFIXTERM> ...
> <WILDTERM> ...
> <REGEXPTERM> ...
> "[" ...
> "{" ...
> <NUMBER> ...
>
> at
> org.apache.lucene.queryparser.classic.QueryParser.generateParseException(QueryParser.java:708)
> at
> org.apache.lucene.queryparser.classic.QueryParser.jj_consume_token(QueryParser.java:590)
> at
> org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:171)
> at
> org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:119)
> ... 25 more
>
>
> What is the proper way to do this?
>