How to use a OR condition in filter

18 views
Skip to first unread message

Boris Miconnet

unread,
Dec 15, 2014, 9:38:08 AM12/15/14
to helio...@googlegroups.com
Hello,

I have a string type field named "status" and I would like to get the documents with status="+" OR status="-" using the filter attribute in the new JSON API.

Below my query sample:

 http://127.0.0.1:8983/solr/event/query?json={query:"source:\"object\" AND timestamp:[2014-12-15T08:00:00.000Z TO 2014-12-15T14:10:00.000Z]" ,filter: "status:\"%2B\" OR status:\"-\"", sort:"timestamp desc", offset: 0, limit: 50}

This syntax returns an error. Could you tell me what's wrong?

Thanks a lot

Yonik Seeley

unread,
Dec 15, 2014, 11:44:51 AM12/15/14
to helio...@googlegroups.com
How are you sending the request? The following worked for me:

curl http://localhost:8983/solr/query -d '
{
query : "source_s:\"object\" AND
timestamp_s:[2014-12-15T08:00:00.000Z TO 2014-12-15T14:10:00.000Z]",
filter : "status_s:\"+\" OR status_s:\"-\"",
sort : "timestamp_s desc",
offset : 0, limit: 50
}
'
Note that if you use curl and put the JSON in the body, you don't
need to worry about doing any URL escaping.

-Yonik
http://heliosearch.org - native code faceting, facet functions,
sub-facets, off-heap data
> --
> You received this message because you are subscribed to the Google Groups
> "heliosearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to heliosearch...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages