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

Won't filter the letter "a" ? #1237

Closed
Jonarod opened this issue May 19, 2020 · 3 comments
Closed

Won't filter the letter "a" ? #1237

Jonarod opened this issue May 19, 2020 · 3 comments

Comments

@Jonarod
Copy link

Jonarod commented May 19, 2020

When I create a simple schema like this:

FT.CREATE test SCHEMA category TEXT SORTABLE subcategory TEXT SORTABLE

Then add entries:

FT.ADD test id_1 0.5 FIELDS category "a" subcategory "b"
FT.ADD test id_2 0.5 FIELDS category "b" subcategory "a"

Search works for "b":

FT.SEARCH test "@category:b" RETURN 0
1) (integer) 1
2) "id_2"

FT.SEARCH test "@subcategory:b" RETURN 0
1) (integer) 1
2) "id_1"

Search completely misses for "a":

FT.SEARCH test "@category:a" RETURN 0
1) (integer) 0  // SHOULD RETURN id_1

FT.SEARCH test "@subcategory:a" RETURN 0
1) (integer) 0  // SHOULD RETURN id_2

I have made several tests changing fields names, etc... it always comes down to the letter "a" being ignored by search: is there something I missed ?

@gkorland
Copy link
Contributor

gkorland commented May 19, 2020

"a" is considered a stop word for tokenization
See: https://oss.redislabs.com/redisearch/Stopwords.html

You can disable these stop words by setting STOPWORDS 0 when creating the schema

@Jonarod
Copy link
Author

Jonarod commented May 19, 2020

Thanks for your lightening fast reply.

My bad... I thought stop words would have been considered only on fields labeled as PHONETIC 😓

I tried to use NOSTOPWORDS in my search, it throws the same result ignoring the letter "a"...

Is there a way to avoid re-indexing all my data set now?

@Jonarod
Copy link
Author

Jonarod commented May 20, 2020

I used STOPWORDS 0 at schema creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants