Questions tagged [range-query]

95 questions
1
vote
1 answer

How to query date range in mongo, where field itself is a date

I have a JSON document stored in mongodb where a sub-document is date-time-stamp. I need to query and filter sub-documents between a date range. I am using mongo shell to play around with the query. { "_id":…
AjitChahal
  • 221
  • 2
  • 7
1
vote
1 answer

Range query for long type in aws elasticsearch

I am trying to query an elasticsearch index in AWS to get all entries with a mass attribute greater than 1000, the datatype for the attribute is Long. I found the range query and have tried that (see example below) but it's returning nothing but…
1
vote
2 answers

Total numbers having frequency k in a given range

How to find total numbers having frequency=k in a particular range(l,r) in a given array. There are total 10^5 queries of format l,r and each query is built on the basis of previous query's answer. In particular, after each query we increment l by…
Mohan Singh
  • 43
  • 1
  • 4
1
vote
1 answer

Which class class is org.apache.lucene.document.IntPoint$1?

I was coded the following lines for other purpose, when I observed a weird thing. The class of q is class org.apache.lucene.document.IntPoint$1, but I really can't find it in the doc. Query q = IntPoint.newExactQuery("year",…
Joe Doe
  • 31
  • 6
1
vote
0 answers

Time range query caching

I have a problem where I am searching for time t1 to time t2 and putting that in cache , if I have to search for t1 to t3 where t3 > t2 then I can take t1 to t2 from cache and search from t2 to t3 I have used Segment Tree for this ,but now the…
vipin
  • 152
  • 12
1
vote
2 answers

check if string of parenthesis is balanced by doing certain operation on string

Given string of parenthesis we have to do 2 kinds of operation: flip- changes the i-th parenthesis into the opposite one(left->right , right->left) check- if the string is a balanced parenthesis expression length of the string is at max 30000.…
1
vote
0 answers

How to do an Elasticsearch range query with gauss function applied too?

How would I construct an ElasticSearch query to satisfy the following: Price must be between 100,000 & 200,000, but also show results outside of this range, but with decreasing relevance if above 200k or below 100k. So far I have the following but…
Lee Overy
  • 437
  • 5
  • 13
1
vote
1 answer

Memory Limit Exceeded with Segment Tree in SPOJ Posters?

Given a horizontal section of wall , and N layers of paints applied from co-ordinates Xi to Yi , Output the distinct number of layers visible. Here is the problem link http://www.spoj.com/problems/POSTERS/ Here is my solution…
1
vote
0 answers

Fast Queries over subarrays

Problem: Given an sorted array of integers a[N], I have to process queries of kind as follow [L R] p : find sum of aiCp for all i=L...R Constraints: N< 105 1<=ai<=106 Suppose there are Q such queries , Then please suggest a better method to…
v78
  • 2,803
  • 21
  • 44
1
vote
1 answer

Cassandra how many columns/row for optimal performance?

I am writing a chat server and, want to store my messages in cassandra. Because I need range queries and I know that I will expect 100 messages/day and maintain history for 6 months I will have 18000 messages for a user at a point. Now, since I'll…
adragomir
  • 457
  • 4
  • 16
  • 33
1
vote
0 answers

Trouble omitting punctuation from Solr Alphabetic Range query search string

I am trying to create a alphabetic browse of names (personal and institutional) using range queries that will sort without regard to punctuation or capitalization, but even though the analysis tool in Solr suggests that punctuation in queries should…
frances
  • 1,232
  • 10
  • 17
1
vote
3 answers

Efficiently SELECT a DB row marked as "latest version" and while matching a given interval

I have a table like so: id min max version data 1 1 10 1 a 2 11 20 1 b 3 21 30 1 c 4 1 10 2 a 5 11 20 2 b 6 21 …
Dennis
  • 7,907
  • 11
  • 65
  • 115
1
vote
1 answer

Cassandra SELECT on 2ndary index always sorted on partition key?

Say I have the following table and secondary indices defined: CREATE TABLE ItemUpdates ( time timestamp, item_name text, item_context text, item_descr text, tags map, PRIMARY KEY ((time,…
Rinke
  • 6,095
  • 4
  • 38
  • 55
1
vote
1 answer

Lucene 4.10 Date Range Query Api

I want to build a range query for a date field programmatically in Lucene 4.10, but I didn't find anyway to do that. My pseudocode would be: new DateRangeQuery(dateLowerBound, dateUpperBound); Is it a good idea to use…
pokeRex110
  • 833
  • 2
  • 14
  • 26
1
vote
2 answers

Elastic Search Date Range Filter Not Working

Context I have an index with a field called "date" which contains dates. I need an elasticsearch query that returns records where date is greater than a specific date value. Issue Running the following query with range filter returns does not…
Allan McLemore
  • 1,222
  • 2
  • 11
  • 12