Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Filtering json strings

Aberta
#32 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
search

Direção de pesquisa

Start by reproducing the filter_by query against the shown schema fields and Typesense version 0.15.0, focusing on the first_data and second_data JSON strings and the some_field array. Determine whether the behavior comes from the filter expression or string representation, then verify the expected result of matching records where either JSON field has a value.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Description

I have two string fields that are part of my filter_by query: first_data and second_data. Either of these fields can have a value or none of them. Their values are set by encoding a Python dictionary to a json string e.g

first_dict = {'age':40}
second_dict = {}

first_data = json.dumps(first_dict, default=str)
second_data = json.dumps(first_dict, default=str)

Steps to reproduce

schema_fields = [
        {
            "name": "first_data", "type": "string",
        },
        {
            "name": "second_data", "type": "string"
        },
        {
            "name": "some_field", "type": "string[]"
        }
]

# Note that I am only checking for emptiness in both fields. There is probably a better approach for this by I wonder this doesn't work

{
  "q": "*",
  "filter_by": "first_data:!={} && second_data:!={} && some_field:=[A,B]"
}

Expected Behavior

I expect to only see results that either first_data or second_data have a value

Actual Behavior

I see results have both first_data and second_data equal to {}
sample

Metadata

Typesense Version: 0.15.0

OS: Ubuntu 22.04.2 LTS

Linguagem predominante
Python
Estrelas
247
Forks
66
Merge médio
22h 47min
PRs com merge (30d)
8

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de typesense/typesense-python

Todas as issues de typesense/typesense-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.