Steve, It's hard to debug queries in this way. Try to experiment with debugQuery=true, pulling fq to q, just for explanation, etc.
On Thu, Jun 9, 2016 at 5:08 PM, Steven White <swhite4...@gmail.com> wrote: > Erick, Mikhail, and Shawn, thank you all for your help. > > > > Just a quick re-cap of what I’m trying to achieve: my need is to combine 2 > or more “fq” queries to be treated as OR. > > > > Erick, Mikhail, I have the syntax you provided but I cannot get them to > work properly, in fact I’m seeing odd behavior that I cannot explain so I > hope you can shed some light on them. > > > > The following give me hits as expected: > > > > 1269 hits: > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateA+v=$a}+{!field+f=DateB+v=$b}+ > > &a=[2000-01-01+TO+2030-01-01]&b=[2000-01-01+TO+2030-01-01] > > > > 1269 hits: > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateA+v=$a}+ > > &a=[2000-01-01+TO+2030-01-01] > > > > 905 hits: > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateB+v=$b}+ > > &b=[2000-01-01+TO+2030-01-01] > > > > The following don’t give me a hit as expected: > > > > 0 hits: > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateA+v=$a}+ > > &a=[2020-01-01+TO+2030-01-01] > > > > 0 hits: > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateB+v=$b}+ > > &b=[2020-01-01+TO+2030-01-01] > > > > The next 3 syntax are odd behavior that I cannot explain: > > > > A) 1269 hits (expected): > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateA+v=$a}+{!field+f=DateB+v=$b}+ > > &a=[2000-01-01+TO+2030-01-01]&b=[2020-01-01+TO+2030-01-01] > > > > B) 905 hits (odd result): > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateB+v=$a}+{!field+f=DateA+v=$b}+ > > &a=[2000-01-01+TO+2030-01-01]&b=[2020-01-01+TO+2030-01-01] > > > > C) 0 hits (but why?!): > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateA+v=$a}+{!field+f=DateB+v=$b}+ > > &a=[2020-01-01+TO+2030-01-01]&b=[2000-01-01+TO+2030-01-01] > > > > D) 0 hits (but why?!): > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > {!field+f=DateB+v=$a}+{!field+f=DateA+v=$b}+ > > &a=[2020-01-01+TO+2030-01-01]&b=[2000-01-01+TO+2030-01-01] > > > > Since my goal here is to have fq apply OR on the two date searches, test B > clearly shows that’s not the case and test C & D shows that fq is ignoring > the second part in the query. > > > > I also tried this syntax: > > > > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > filter({!field+f=DateA+op=Intersects}[2000-01-01+TO+2020-01-01])+ > > filter({!field+f=DateB+op=Intersects}[2000-01-01+TO+2030-01-01]) > > > > But Solr is reporting an error: “no field name specified in query and no > default specified via 'df' param”. > > > > Shawn, using the syntax that you suggested everything works (including my > mix date range tests of the above): > > > > > http://localhost:8983/solr/openpages/select_openpages_3?start=0&q=*&q.op=AND?&q=*&fq= > > DateA:[2000-01-01+TO+2030-01-01]+OR+DateB:[2000-01-01 TO 2030-01-01] > > > > My motivation to use “{!field}[]” in fq was what I read somewhere (I cannot > find it now, even after many Google’s on it) is far faster and efficient > than the tradition <Field-Name>:[value] > > > > Steve > > On Wed, Jun 8, 2016 at 6:46 PM, Shawn Heisey <apa...@elyograg.org> wrote: > > > On 6/8/2016 2:28 PM, Steven White wrote: > > > > ?q=*&q.op=OR&fq={!field+f=DateA+op=Intersects}[2020-01-01+TO+2030-01-01] > > > > Looking at this and checking the code for the Field query parser, I > > cannot see how what you have used above is any different than: > > > > fq=DateA:[2020-01-01 TO 2030-01-01] > > > > The "op=Intersects" parameter that you have included appears to be > > ignored by the parser code that I examined. > > > > If my understanding of the documentation and the code is correct, then > > you should be able to use this: > > > > fq=DateB:[2000-01-01 TO 2020-01-01] OR DateA:[2020-01-01 TO 2030-01-01] > > > > In my examples I have changed the URL encoded "+" character back to a > > regular space. > > > > Thanks, > > Shawn > > > > > -- Sincerely yours Mikhail Khludnev Principal Engineer, Grid Dynamics <http://www.griddynamics.com> <mkhlud...@griddynamics.com>