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

Logic Error for non-indexed facets #1195

Closed
PSeitz opened this issue Nov 2, 2021 · 0 comments
Closed

Logic Error for non-indexed facets #1195

PSeitz opened this issue Nov 2, 2021 · 0 comments
Labels

Comments

@PSeitz
Copy link
Contributor

PSeitz commented Nov 2, 2021

When adding facets which are not indexed merge fails.

thread 'merge_thread2' panicked at 'Logic Error in Tantivy (Please report). HierarchicalFact field should have required a`term_ordinal_mapping`.', /home/pascal/LinuxData/Development/tantivy/blockedbitp/src/
indexer/merger.rs:279:26

Which version of tantivy are you using?
master

To Reproduce

Paste in merger.rs

    #[test]
    fn test_non_index_facets() {
        {
            let mut schema_builder = schema::Schema::builder();
            let facet_field = schema_builder.add_facet_field("facet", STORED);
            let index_builder = Index::builder().schema(schema_builder.build());
            let index = index_builder.create_in_ram().unwrap();
            {
                let mut index_writer = index.writer_for_tests().unwrap();
                let index_doc = |index_writer: &mut IndexWriter, doc_facets: &[&str]| {
                    let mut doc = Document::default();
                    for facet in doc_facets {
                        doc.add_facet(facet_field, Facet::from(facet));
                    }
                    index_writer.add_document(doc);
                };

                index_doc(&mut index_writer, &["/top/a/firstdoc", "/top/b"]);
                index_doc(&mut index_writer, &["/top/a/firstdoc", "/top/b", "/top/c"]);
                index_doc(&mut index_writer, &["/top/a", "/top/b"]);
                index_doc(&mut index_writer, &["/top/a"]);

                index_writer.commit().expect("committed");
                index_doc(&mut index_writer, &["/top/a"]);

                index_doc(&mut index_writer, &["/top/b"]);
                index_writer.commit().expect("committed");
            }

            // Merging the segments
            {
                let segment_ids = index
                    .searchable_segment_ids()
                    .expect("Searchable segments failed.");
                let mut index_writer = index.writer_for_tests().unwrap();
                block_on(index_writer.merge(&segment_ids)).expect("Merging failed");
                index_writer.wait_merging_threads().unwrap();
            }
        }
    }

Expected Behaviour
Not sure, facets should be automatically flagged as indexed?

@fulmicoton fulmicoton added the bug label Dec 1, 2021
fulmicoton added a commit that referenced this issue Dec 1, 2021
fulmicoton added a commit that referenced this issue Dec 1, 2021
Facets are now always indexed.

Closes #1195
fulmicoton added a commit that referenced this issue Dec 1, 2021
Facets are now always indexed.

Closes #1195
@fulmicoton fulmicoton reopened this Dec 2, 2021
fulmicoton added a commit that referenced this issue Dec 2, 2021
This reverts commit dde49ac.
fulmicoton added a commit to lpouget/tantivy that referenced this issue Dec 10, 2021
Removes the indexed option for facets.
Facets are now always indexed.

Closes quickwit-oss#1195
This was referenced Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants