Comments (3)
https://gist.github.com/mmastrac/a06dddbdc2734bde74764edae7418333
from tantivy.
confirmed as a bug
from tantivy.
Thanks for the report!
For better performance, we try to convert the users value to the value space of the fast field when running get_docids_for_value_range . With GCD, the value space gets smaller. e.g. [0, 100, 200]
is mapped to [0,1,2]
. We cannot map a incoming user value of 50 to that user space exactly.
Currently inverse mapping is executed self.monotonic_mapping.inverse(50)
, which returns 0. Instead we need to detect that we are outside the value space and map to the closest next value. +1 for the start of the range, and -1 for the end of the range
Minimal Example
#[test]
fn test_gcd_bug_regression_1757() {
let mut schema_builder = Schema::builder();
let num_field = schema_builder.add_u64_field("url_norm_hash", FAST | INDEXED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
{
let mut writer = index.writer_for_tests().unwrap();
writer
.add_document(doc! {
num_field => 100u64,
})
.unwrap();
writer
.add_document(doc! {
num_field => 200u64,
})
.unwrap();
writer.commit().unwrap();
}
let reader = index.reader().unwrap();
let searcher = reader.searcher();
let segment = &searcher.segment_readers()[0];
let field = segment.fast_fields().u64(num_field).unwrap();
let mut vec = vec![];
field.get_docids_for_value_range(150..=150, 0..u32::MAX, &mut vec);
assert_eq!(vec.len(), 0);
}
Buggy Code
This part of the code needs to be able to handle user data
fn get_docids_for_value_range(
&self,
range: RangeInclusive<Output>,
doc_id_range: Range<u32>,
positions: &mut Vec<u32>,
) {
self.from_column.get_docids_for_value_range(
self.monotonic_mapping.inverse(range.start().clone())
..=self.monotonic_mapping.inverse(range.end().clone()),
doc_id_range,
positions,
)
}
from tantivy.
Related Issues (20)
- Panic occured while committing writer with sort by text field. HOT 6
- Index encryption via Encrypted Directory [reopen]
- Requesting tantivy release to support zstd dependency HOT 9
- Panic on document of death
- MemorySanitizer: use-of-uninitialized-value (probably false positive)
- Top Hits Agg Performance: Delay fetching `get_document_field_data` in top_hits
- top_hits aggregation parameter validation HOT 1
- add `top_metrics` aggregation
- Planned removal of index sorting in 0.23.0 HOT 4
- Regular Expression Queries HOT 1
- Occur - Phrase query with slop HOT 1
- Negative Term HOT 2
- FuzzyTermQuery, PhrasePrefixQuery, PhraseQuery --> Snippets / actual matches
- tantivy vs Lucene benchmark confusion HOT 5
- Questions about the details of how Tantivy manages index files. HOT 2
- Replace PreTokenizedString
- support multiple modes of execution for fastfield range query
- Addition of a migration guide from Lucene to Tantivy HOT 2
- Store DateTime as nanos in docstore HOT 2
- QueryParser raises SyntaxError when combining field prefix with nested searchstring
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tantivy.