eadwinCode/django-ninja-extra

Full text search (@) error

Closed this issue · 3 comments

Hi,
When i try to use the full text search it looks like the character '@' is not well recognized.
I am on a PostegreSQL backend and the other characters seems to work as expect.

Is this a bad configuration on my side ? it looks like the documentation does not say more about this.

Thanks,

Here is the traceback

Traceback (most recent call last):
 File "lib/python3.12/site-packages/ninja_extra/operation.py", line 318, in run
   result = await self.view_func(request, **values)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/ninja_extra/controllers/route/route_functions.py", line 180, in as_view
   result = await self.route.view_func(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/ninja_extra/pagination/operations.py", line 87, in as_view
   items = await self.view_func(request_or_controller, *args, **func_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/ninja_extra/searching.py", line 283, in as_view
   return await searching_queryset(items, searching_params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/asgiref/sync.py", line 468, in __call__
   ret = await asyncio.shield(exec_coro)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
   result = self.fn(*self.args, **self.kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/asgiref/sync.py", line 522, in thread_handler
   return func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/ninja_extra/searching.py", line 111, in searching_queryset
   item for item in items if self.filter_spec(item, conditions_list)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "lib/python3.12/site-packages/ninja_extra/searching.py", line 171, in filter_spec
   if not any(
          ^^^^
 File "lib/python3.12/site-packages/ninja_extra/searching.py", line 172, in <genexpr>
   lookup_func(item_getter(field)(item), lookup_value)
               ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MyModel' object has no attribute '@my_var'

@EricGadbin Can you provide the endpoint setup also?

Hello !
I tried to make a search on my own and understood my mistake.
I was not working with a QuerySet because of some async functions i did so obviously it could not work.
Thanks and sorry for opening a issue for nothing.

Thats Awesome. No problem