mosuka / blast

Blast is a full text search and indexing server, written in Go, built on top of Bleve.
Apache License 2.0
1.08k stars 76 forks source link

How to use simple analyzer? #141

Closed lauthrul closed 3 years ago

lauthrul commented 3 years ago

Hi, I want to use simple analyzer for removing english stop words and leave othe feature as default. I see the example you provided, and customized my mapping like this:

{
    "default_mapping": {
        "enabled": true,
        "dynamic": true,
        "default_analyzer": "simple"
    },
    "type_field": "_type",
    "default_type": "_default",
    "default_analyzer": "simple",
    "default_datetime_parser": "dateTimeOptional",
    "default_field": "_all",
    "store_dynamic": true,
    "index_dynamic": true,
    "analysis": {
        "analyzers": {},
        "char_filters": {},
        "tokenizers": {},
        "token_filters": {},
        "token_maps": {}
    }
}

But this didn't work. When I index a field with text "I'm not a hero", I still can't seach by keyword "not". I'm not sure if the mapping is correct, can you help me to check it out?

lauthrul commented 3 years ago

Alright, I find a solution, just remove data folder and rebuild all indexs. Maybe the storage still use the old analyzer?

mosuka commented 3 years ago

Hi @lauthrul , Sorry for the late reply.

Yes. The existing index retains the previous mappings, so if you change the mappings, I think you will need to recreate the index.