Thanks Alvaro. That worked. On Tue, Jan 20, 2015 at 9:59 AM, harish singh <harish.sing...@gmail.com> wrote:
> ok. So I am trying this query: > > > http://cluster1.com:8983/solr/my_collection_shard4_replica1/select?q=*%3A*&rows=0&wt=json&indent=true&facet=true&facet.field=userName&fq=startTimeISO:[NOW-1DAY%20TO%20NOW]&fq=-_query_:%22{!join%20from=% > userName%20to=%userName}startTimeISO:[NOW-30DAYS%20TO%20NOW-1DAYS]%22 > > This query is giving me results. I will now validate it. > > Just to confirm, Is this the right query that I am using? Please correct > me if I am wrong here. > > On Tue, Jan 20, 2015 at 9:47 AM, Alvaro Cabrerizo <topor...@gmail.com> > wrote: > >> Hi, >> >> In case your data looks like: >> >> "id": "1", >> "userName": "one", >> "startTimeISO": "2015-01-20T17:24:32.888Z" >> >> "id": "2", >> "userName": "one", >> "startTimeISO": "2015-01-16T17:24:50.208Z" >> >> "id": "3", >> "userName": "two", >> "startTimeISO": "2015-01-20T17:25:06.109Z" >> >> >> You could use the next query combination >> >> q=*:* >> fq=startTimeISO:[NOW-1DAY TO NOW] //this will give you all the users that >> were seen today >> fq=-_query_:"{!join from=userName to=userName}startTimeISO:[NOW-30DAYS TO >> NOW-1DAYS]" //dont include those documents that have others with the same >> name and were viewed during the last 30 days. >> >> Regards. >> >> >> >> >> >> >> >> >> >> On Tue, Jan 20, 2015 at 5:32 PM, harish singh <harish.sing...@gmail.com> >> wrote: >> >> > Well, that is the problem I am facing. Just checking if there is a way >> to >> > compute the diff from 18th for the 19th. >> > One option is: >> > Get all the facets for 19th. >> > Get all facets for 18th. >> > Do a diff and Eliminate intersection. >> > >> > But this isn't optimal as the number of facets returned but solr query >> can >> > be huge. >> > >> > Any other way to get around with? Any tool that solr provides? >> > >> > On Tue, Jan 20, 2015, 8:10 AM Shawn Heisey <apa...@elyograg.org> wrote: >> > >> > > On 1/20/2015 8:52 AM, harish singh wrote: >> > > > Yes I got that. But I am still stuck at this point. Consider it like >> > > this: >> > > > I do not know what are the usernames in all the documents. >> > > > I only know there is time associated with each record. >> > > > >> > > > So Say, I have usernames "a", "b", "c", "d" present in my data for >> the >> > > 18th >> > > > of January. >> > > > And for the 19th, I have usernames "a", "b","c", "d", "e". >> > > > Then my query for newly observed username for today over last two >> days >> > > > should return me "e" >> > > >> > > If you query for only documents that match the 19th, and those >> documents >> > > contain all five usernames, you're going to get all five usernames in >> > > your facet. Solr has no way to know that the other four usernames >> > > should be excluded - it can only show you facets for the documents >> > > matching your query, the other documents in your index will have no >> > > bearing on the results. >> > > >> > > Thanks, >> > > Shawn >> > > >> > > >> > >> > >