lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack L <>
Subject Re[3]: Multiple fq fields in URL
Date Sun, 13 May 2007 22:45:35 GMT
Hello Chris,

When I read your email again, I find that I didn't understand it
very well, because although fq works for me now, when I need to
construct the q variable, I run into the same set of questions
and am still not clear :)

> : BTW, space is sometimes encoded as %20, sometimes as "+".
> : So, solr expects %20 in this case? Or both are fine?

> this is where i realized i did a really bad job answering your question
> ... + as an escping for space is fine .. it's unfortunate thta it's also
> the charcter denoting a mandatory clause in a lucene query, and that when
> splitting your big fq into two seperate fqs you no longer need the + to
> make them mandatory since they are seperate params that by definition must
> match.

1. I didn't understand the part above in your reply. If I search for
samsung camera, the query should be like this in the select URL:


And if samsung is mandatory, the query will be like this: (or not:)


And the first + will be interpreted as mandatory flag?

2. It seems that + may come from a few different things:
   - mandatory flag in Lucene query
   - space escaping
   - to specify multiple q or fq clauses as in:
     fq=+popularity:[10 TO *] +section:0

And I have a hard time assuring myself that they'll work correctly
for me.

In my case, I want to search in a title field and a content field.
And I think the query should look like this in the URL: (no mandatory terms)

   q=+title:samsung camera +content:samsung camera

with spaces escaped with +:


Is this correct? I'm very unsure already because of the ++.

3. And if I'm correct, I can do the same query with multiple
q variables in the URL, just like what I can do with fq:

   q=title:samsung camera&q=content:samsung camera

with spaces escaped with +:


4. To simplify it a bit, if I have defined content field as
default search field, the query will be:

   q=+title:samsung camera +samsung camera

with spaces escaped with +:


5. To complicate it a bit, let's say the query is supposed to
search samsung camera in both fields, but samsung in title is

   q=+title:+samsung camera +content:samsung camera

with spaces escaped:


Is this correct?

6. I'm compelled to list both the non-escaped format and the escaped
format above because I can not help thinking that the + may
cause problems :)

Best regards,

View raw message