You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: inverted_index_writer.rs
    path of file: ./repos/databend/src/query/storages/fuse/src/io/write
    
    the code of the file until where you have to start completion: // Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright (c) 2018 by the tantivy project authors
// (https://github.com/quickwit-oss/tantivy), as listed in the AUTHORS file.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

u
    
    pub fn try_create(schema: DataSchema) -> Result<InvertedIndexWriter> {
        let text_field_indexing = TextFieldIndexing::default()
            .set_tokenizer("en")
            .set_index_option(IndexRecordOption::WithFreqsAndPositions);
        let text_options = TextOptions::default().set_indexing_options(text_field_indexing);

        let mut schema_builder = Schema::builder();
        let mut index_fields = Vec::with_capacity(schema.fields.len());
        for field in &schema.fields {
            if field.data_type().remove_nullable() != DataType::String {
                return Err(ErrorCode::IllegalDataType(format!(
                    "inverted index only support String type, but got {}",
                    field.data_type()
                )));
            }
            let index_field = schema_builder.add_text_field(field.name(), text_options.clone());
            index_fields.push(index_field);
        }
        let index_schema = schema_builder.build();

        let index_settings = IndexSettings {
            sort_by_field: None,
            ..Default::default()
        };
        let tokenizer_manager = TokenizerManager::new();
        tokenizer_manager.register(
            "en",
            TextAnalyzer::builder(SimpleTokenizer::default())
                .filter(RemoveLongFilter::limit(40))
                .filter(LowerCaser)
                .filter(Stemmer::new(Language::English))
                .build(),
        );

        let index_builder = IndexBuilder::new()
            .settings(index_settings)
            .schema(index_schema.clone())
            .tokenizers(tokenizer_manager.clone());

        let ram_directory = RamDirectory::create();
        let index_writer = index_builder.single_segment_index_writer(ram_directory, 50_000_000)?;

        Ok(Self {
            schema,
            index_writer,
        })
    }