theodo-fintech / spring-search

Provides advanced search capabilities to a JPA entity
MIT License
193 stars 44 forks source link

Not Allowing _ inside the key of a search spec #85

Closed yashbalija1 closed 5 months ago

yashbalija1 commented 9 months ago

Summary

{ "novelname": "abc" }

As per the above JSON, I am trying to search like
?search=novel.novelname:null&size=2 and also ?search=novel.novel%5Fname%5F:null&size=2 but getting an error like nested exception is java.lang.NullPointerException: visit(ctx.query()) must not be null

@mlz11 Can you please help me out understanding this and how it can be achieved?

Stacktrace

"status": 500, "error": "Internal Server Error", "exception": "java.lang.NullPointerException", "message": "org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException: visit(ctx.query()) must not be null",

phmz commented 9 months ago

Hello @yashbalija1

Thank you for reporting this issue! To help us understand and address the problem more effectively, we need a few additional details:

yashbalija1 commented 9 months ago

Hello @phmz

Thanks for replying.

  1. I am currently using the 0.2.4 version for spring search.
  2. I am working with Java 8.

The entity model looks something like below.

public class Entity{
    @Column(name = "books")
    @Convert(converter = JsonNodeConverter.class)
    private JsonNode books;
    @Column(name = "author")
    private String author;
}

the book's column data that is stored in my db looks something like below.

{
  "book_name": "Into the future",
  "published_on":"2022-12-12",
}

Now I am trying to do a search spec on the above entity.

?search=books.book_name!null OR ?search=books.book_name:null

phmz commented 9 months ago

Hello @yashbalija1,

After reviewing your issue, the feature you're asking about is not supported in our project at this time. If you're interested and able to contribute this functionality, we would greatly appreciate a pull request.