We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
按照demo像下面这样不行,分词效果还是bleve默认的:
func (h *CreateIndexHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { // find the name of the index to create var indexName string if h.IndexNameLookup != nil { indexName = h.IndexNameLookup(req) } if indexName == "" { showError(w, req, "index name is required", 400) return } indexMapping := bleve.NewIndexMapping() // err := indexMapping.AddCustomTokenizer("gojieba", map[string]interface{}{ "dictpath": gojieba.DICT_PATH, "hmmpath": gojieba.HMM_PATH, "userdictpath": gojieba.USER_DICT_PATH, "type": "gojieba", "idf": gojieba.IDF_PATH, "stop_words": gojieba.STOP_WORDS_PATH, }, ) if err != nil { panic(err) } err = indexMapping.AddCustomAnalyzer("gojieba", map[string]interface{}{ "type": "gojieba", "tokenizer": "gojieba", }, ) if err != nil { panic(err) } indexMapping.DefaultAnalyzer = "gojieba" // read the request body requestBody, err := ioutil.ReadAll(req.Body) if err != nil { showError(w, req, fmt.Sprintf("error reading request body: %v", err), 400) return } // interpret request body as index mapping if len(requestBody) > 0 { err := json.Unmarshal(requestBody, &indexMapping) if err != nil { showError(w, req, fmt.Sprintf("error parsing index mapping: %v", err), 400) return } } newIndex, err := bleve.New(h.indexPath(indexName), indexMapping) if err != nil { showError(w, req, fmt.Sprintf("error creating index: %v", err), 500) return } newIndex.SetName(indexName) bhttp.RegisterIndexName(indexName, newIndex) rv := struct { Status string `json:"status"` }{ Status: "ok", } mustEncode(w, rv) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
按照demo像下面这样不行,分词效果还是bleve默认的:
The text was updated successfully, but these errors were encountered: