Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize on a single fast hasher, i.e. rustc-hash #2280

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ common = { version= "0.6", path = "./common/", package = "tantivy-common" }
tokenizer-api = { version= "0.2", path="./tokenizer-api", package="tantivy-tokenizer-api" }
sketches-ddsketch = { version = "0.2.1", features = ["use_serde"] }
futures-util = { version = "0.3.28", optional = true }
fnv = "1.0.7"

[target.'cfg(windows)'.dependencies]
winapi = "0.3.9"
Expand Down
4 changes: 2 additions & 2 deletions src/core/inverted_index_reader.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io;

use common::BinarySerializable;
use fnv::FnvHashSet;
use rustc_hash::FxHashSet;

use crate::directory::FileSlice;
use crate::positions::PositionReader;
Expand Down Expand Up @@ -78,7 +78,7 @@ impl InvertedIndexReader {
pub fn list_encoded_fields(&self) -> io::Result<Vec<(String, Type)>> {
let mut stream = self.termdict.stream()?;
let mut fields = Vec::new();
let mut fields_set = FnvHashSet::default();
let mut fields_set = FxHashSet::default();
while let Some((term, _term_info)) = stream.next() {
if let Some(index) = term.iter().position(|&byte| byte == JSON_END_OF_PATH) {
if !fields_set.contains(&term[..index + 2]) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/segment_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::ops::BitOrAssign;
use std::sync::{Arc, RwLock};
use std::{fmt, io};

use fnv::FnvHashMap;
use itertools::Itertools;
use rustc_hash::FxHashMap;

use crate::core::{InvertedIndexReader, Segment, SegmentComponent, SegmentId};
use crate::directory::{CompositeFile, FileSlice};
Expand Down Expand Up @@ -300,7 +300,7 @@ impl SegmentReader {
/// to not be listed.
pub fn fields_metadata(&self) -> crate::Result<Vec<FieldMetadata>> {
let mut indexed_fields: Vec<FieldMetadata> = Vec::new();
let mut map_to_canonical = FnvHashMap::default();
let mut map_to_canonical = FxHashMap::default();
for (field, field_entry) in self.schema().fields() {
let field_name = field_entry.name().to_string();
let is_indexed = field_entry.is_indexed();
Expand Down
4 changes: 2 additions & 2 deletions src/indexer/path_to_unordered_id.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fnv::FnvHashMap;
use rustc_hash::FxHashMap;

/// `Field` is represented by an unsigned 32-bit integer type.
/// The schema holds the mapping between field names and `Field` objects.
Expand All @@ -24,7 +24,7 @@ impl From<u32> for OrderedPathId {

#[derive(Default)]
pub(crate) struct PathToUnorderedId {
map: FnvHashMap<String, u32>,
map: FxHashMap<String, u32>,
}

impl PathToUnorderedId {
Expand Down
Loading