Litedb: Beta 3 do not perform case insensitive search via link expression

Created on 11 Jan 2017  Â·  8Comments  Â·  Source: mbdavid/LiteDB

not perform case insensitive search via link expression in beta 3.0
Example of query:
Collection.Find(p => p.razaoSocialEmp.Contains(termo) || p.nomeEmp.Contains(termo))
Its work in older version (case insensitive search)

question

Most helpful comment

awesome David!. That is so cool. I've always wanted to learn Portuguese.
I know 21 programming languages and 3 human languages (English, Afrikaans
and Japanese)
On Jan 12, 2017 12:14 AM, "Mauricio David" notifications@github.com wrote:

@xX-MLG-Xx https://github.com/xX-MLG-Xx, sorry but I will anwser in
portuguese :) (it's my first opportunity here)

E ae Daniel, como é bom poder explicar em português ao menos uma vez :)...
tão mais facil... hehehe

Seguinte, a vesão 3 não oferece mais transformação nos indices. Ou seja,
não faz trim, não faz lowercase nem nada. Até a versão 2 isso era possivel,
mas resolvi descontinuar por problemas de compatibilidade e padrões.
Neste caso, tu precisa criar uma coluna nova com o dado transformado (como
o Dean falou) ou criar um "Virtual Index", usando no mapeador
BsonMapper.Global.Entity().Index("razaoSocialIndex", x =>
x.razaoSocialEmp.ToLower()). Neste caso, a query precisa rodar sem LINQ,
usando Query.Contains("razaoSocialIndex", termo).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424#issuecomment-272012664, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVQ2C04fK_Z7PMz2f0dn9yBEnkE1R6zvks5rRVQ7gaJpZM4LhHJg
.

All 8 comments

hi there.

use linq and create a comparable lambda function and and convert both the
key name's value and your search term's value to lower or uppercase and
then do an equality check then return the result to the callee.

this is small solution implementation to aid in this problem

regards. Dean
On Jan 11, 2017 11:50 PM, "danielcastilho" notifications@github.com wrote:

not perform case insensitive search via link expression in beta 3.0
Example of query:
Collection.Find(p => p.razaoSocialEmp.Contains(termo) ||
p.nomeEmp.Contains(termo))
Its work in older version (case insensitive search)

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424, or mute the thread
https://github.com/notifications/unsubscribe-auth/AVQ2C9I-uM7VuFLItDlCr3p0FIWozAAoks5rRU6WgaJpZM4LhHJg
.

@xX-MLG-Xx, sorry but I will anwser in portuguese :) (it's my first opportunity here)

E ae Daniel, como é bom poder explicar em português ao menos uma vez :)... tão mais facil... hehehe

Seguinte, a vesão 3 não oferece mais transformação nos indices. Ou seja, não faz trim, não faz lowercase nem nada. Até a versão 2 isso era possivel, mas resolvi descontinuar por problemas de compatibilidade e padrões.
Neste caso, tu precisa criar uma coluna nova com o dado transformado (como o Dean falou) ou criar um "Virtual Index", usando no mapeador BsonMapper.Global.Entity<Cliente>().Index("razaoSocialIndex", x => x.razaoSocialEmp.ToLower()). Neste caso, a query precisa rodar sem LINQ, usando Query.Contains("razaoSocialIndex", termo).

awesome David!. That is so cool. I've always wanted to learn Portuguese.
I know 21 programming languages and 3 human languages (English, Afrikaans
and Japanese)
On Jan 12, 2017 12:14 AM, "Mauricio David" notifications@github.com wrote:

@xX-MLG-Xx https://github.com/xX-MLG-Xx, sorry but I will anwser in
portuguese :) (it's my first opportunity here)

E ae Daniel, como é bom poder explicar em português ao menos uma vez :)...
tão mais facil... hehehe

Seguinte, a vesão 3 não oferece mais transformação nos indices. Ou seja,
não faz trim, não faz lowercase nem nada. Até a versão 2 isso era possivel,
mas resolvi descontinuar por problemas de compatibilidade e padrões.
Neste caso, tu precisa criar uma coluna nova com o dado transformado (como
o Dean falou) ou criar um "Virtual Index", usando no mapeador
BsonMapper.Global.Entity().Index("razaoSocialIndex", x =>
x.razaoSocialEmp.ToLower()). Neste caso, a query precisa rodar sem LINQ,
usando Query.Contains("razaoSocialIndex", termo).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424#issuecomment-272012664, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AVQ2C04fK_Z7PMz2f0dn9yBEnkE1R6zvks5rRVQ7gaJpZM4LhHJg
.

Muito obrigado! Tanks! Um pouco mais complicado creio.. mas é o que temos
para hoje.. Esta forma de pesquisar "insesitive" vai ser a definitiva?
Amanhã vou fazer meus testes da saua dica, Valeu Mauricio!

Em qua, 11 de jan de 2017 às 20:22, Dean Van Greunen <
[email protected]> escreveu:

awesome David!. That is so cool. I've always wanted to learn Portuguese.
I know 21 programming languages and 3 human languages (English, Afrikaans
and Japanese)
On Jan 12, 2017 12:14 AM, "Mauricio David" notifications@github.com
wrote:

@xX-MLG-Xx https://github.com/xX-MLG-Xx, sorry but I will anwser in
portuguese :) (it's my first opportunity here)

E ae Daniel, como é bom poder explicar em português ao menos uma vez
:)...
tão mais facil... hehehe

Seguinte, a vesão 3 não oferece mais transformação nos indices. Ou seja,
não faz trim, não faz lowercase nem nada. Até a versão 2 isso era
possivel,
mas resolvi descontinuar por problemas de compatibilidade e padrões.
Neste caso, tu precisa criar uma coluna nova com o dado transformado
(como
o Dean falou) ou criar um "Virtual Index", usando no mapeador
BsonMapper.Global.Entity().Index("razaoSocialIndex", x =>
x.razaoSocialEmp.ToLower()). Neste caso, a query precisa rodar sem LINQ,
usando Query.Contains("razaoSocialIndex", termo).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424#issuecomment-272012664,
or mute
the thread
<
https://github.com/notifications/unsubscribe-auth/AVQ2C04fK_Z7PMz2f0dn9yBEnkE1R6zvks5rRVQ7gaJpZM4LhHJg

.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424#issuecomment-272014667, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAM3XDZseIWQrzpfXNcbG-eOFG3Rsmixks5rRVYwgaJpZM4LhHJg
.

@danielcastilho @xX-MLG-Xx @mbdavid I faced the same issue recently, i did solve it by using lower case conversion.

@danielcastilho, sim, será definitiva pois, por definição, indices não podem alterar o valor. Abraço

Oi Mauricio, infelizmente tentei de todas as formas e não consegui
pesquisar de forma insensitive:
Ao usar:

BsonMapper.Global.Entity().Index("razaoSocialIndex",
(x) => x.razaoSocialEmp.ToLower());

na Inicialização do código

e depois na pesquisa da seguinte forma

return Collection.Find(Query.Contains("razaoSocialIndex", termo.ToLower()))

Não retorna registros nem no case original nem na forma insensitive...

usando o código anterior:

return Collection.Find(p => p.razaoSocialEmp.Contains(termo))

carrega só que pesquisando usando o case "sensitive"

Tem algo errado Aqui?

Em qui, 12 de jan de 2017 às 08:49, Mauricio David notifications@github.com
escreveu:

@danielcastilho https://github.com/danielcastilho, sim, será definitiva
pois, por definição, indices não podem alterar o valor. Abraço

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mbdavid/LiteDB/issues/424#issuecomment-272132636, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAM3XDW8UW74-EEFLQE4KyTu8GLy2ZKtks5rRgUigaJpZM4LhHJg
.

Oi Daniel, a principio tá certo teu codigo. Vou montar um unit test para verificar o que pode estar ocorrendo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darcome picture darcome  Â·  3Comments

furesoft picture furesoft  Â·  4Comments

dangershony picture dangershony  Â·  3Comments

muhamad picture muhamad  Â·  3Comments

axelgenus picture axelgenus  Â·  3Comments