Hi and thanks for all the answers. I finally managed to construct a fq that did what I wanted
fq=(-(-obj_todate_dt:[NOW/MINUTE TO *] AND obj_todate_dt:[* TO *]) AND -(-obj_fromdate_dt:[* TO NOW/MINUTE] AND obj_fromdate_dt:[* TO *])) This gave me all documents without opening and closing time, and those documents that should be open for viewable . Have to use minutes since the solution uses minutes on opening and closing time. friendly Jan Eirik On Tue, Mar 22, 2011 at 1:41 AM, Jonathan Rochkind <rochk...@jhu.edu> wrote: > If the "OR" actually worked to do what it's trying to say, would it be what > you wanted? > > Because I can't believe I didn't recognize this is an instance of the very > thing I posted on this list this morning, where the solr-lucene query parser > has problems with some kinds of 'pure negative' queries. Try this as a > workaround to those problems: > > fq=(*:* AND -openingtime:[* TO *]) OR openingtime:[* TO NOW] > > If the semantics we're trying to express there are in fact what you want, > there's probably a way to make it work, if the problem is just how to > actually get solr to give you "everything without an opening time or an > opening time before NOW" in an fq. > > Jonathan > ________________________________________ > From: Jan-Eirik B. Nævdal [jan-eirik.naev...@iterate.no] > Sent: Monday, March 21, 2011 6:55 PM > To: Jonathan Rochkind > Cc: solr-user@lucene.apache.org > Subject: Re: Problems with creating a query that matches all the documents > I want to display > > Unfortunalty have I tried the OR approach in the fq. > with the positive filter query first i get document 4, with negative filter > query first i get none result, > This request gives me 1 reply > > http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=100&indent=on]&fq=obj_todate_dt%3A[*%20TO%20NOW]%20&fq=obj_todate_dt%3A[NOW%20TO%20* > ] > > same as this (but if %20 is used between OR it would not give any hits) > > > http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=100&indent=on]&fq=obj_fromdate_dt%3A[*%20TO%20NOW]OR-obj_fromdate_dt%3A[*%20TO%20*]&fq=obj_todate_dt%3A[NOW%20TO%20*]OR-obj_todate_dt%3A[*%20TO%20* > ] > > > This does not give any result: > > http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=100&indent=on]&fq=-obj_fromdate_dt%3A[*%20TO%20*]ORobj_fromdate_dt%3A[*%20TO%20NOW]&fq=-obj_todate_dt%3A[*%20TO%20*]ORobj_todate_dt%3A[NOW%20TO%20* > ] > > > Testing both on 1.3 1.4 just to be sure, and changing default operator to > OR > Im running a standard solr 1.4.1 schema and just added these to dynamic > fileds in the example docs, just to make it easy to test for me. > > > On Mon, Mar 21, 2011 at 10:53 PM, Jonathan Rochkind <rochk...@jhu.edu > <mailto:rochk...@jhu.edu>> wrote: > You can put an actual OR in the fq (an fq, by default, is in the > solr-lucene query parser language). Might that achieve what you want? > > &fq= -openingtime:[* TO *] OR openingtime:[* TO NOW] > &fq= -closingtime:[* TO *] OR closingtime:[NOW TO *] > > Does that, or some variation of it, do what you need? > > > On 3/21/2011 5:43 PM, Jan-Eirik B. Nævdal wrote: > Hi > Have this problem I tried to solve with filter queries but I think I`m > stuck > now, and don't see a solution how to solve my problem. > > My problem is that i want a result page that shows those documents that > matches > these filter query fq=openingtime:[* TO NOW] , fq=closingtime[NOW TO *] for > the documents with limited time access > but i want also all documents that does not have the fields openingtime and > closingtime defined > like this filter query fq=-openingtime[* TO *] and fq = -closingtime[* TO > *] > > Are there some solution that allows me to make a "join" of these two filter > queries, that supports pagination. > A client side "manual" join would not be the best solution here because of > the system the results are displayed in. > > Simple example: > Document 1 : openingtime = 1545 1. May.2050 closingtime 1453 1. June.2050 > //available in the future > Document 2: Does not have the fields openingtime and closing time > Document 3 Does not have the fields openingtime and closing time > Document 4 openingtime = 1545 1. May.2010 closingtime 1453 1. June.2030 / > available now > > My result page should then show document 2,3 and 4 but not document 1 > Can anyone point me in the direction how to solve this > > > Technical information: > Solr 1.4.1 (is being ported from 1.3) (reasons for going to 3.x would be > appreciated > Default operator: AND > Several different documents where one type should only be displayed in the > results for a limited time. This information is indexed as dates in that > type of document. > Those fields does not exist on the other documents in the index. > Not any major changes in the schema.xml > A solr instance here can contain between 5K-10M documents > > > > JanEirik > > > > > -- > Jan Eirik B. Nævdal > Solutions Engineer | +47 982 65 347<tel:%2B47%20982%2065%20347> > Iterate AS | www.iterate.no<http://www.iterate.no> > The Lean Software Development Consultancy > -- Jan Eirik B. Nævdal Solutions Engineer | +47 982 65 347 Iterate AS | www.iterate.no The Lean Software Development Consultancy