Skip to content

Commit

Permalink
fix: supporting '+' character in filter param
Browse files Browse the repository at this point in the history
  • Loading branch information
ajclopez committed Jun 2, 2024
1 parent 48ac7c9 commit deb6735
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Include the dependency to your project inside your `pom.xml` file
<dependency>
<groupId>io.github.ajclopez</groupId>
<artifactId>mongo-spring-search</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
</dependency>
```

Expand All @@ -65,17 +65,17 @@ Include the dependency to your project inside your `pom.xml` file
Add implementation to your project in your `build.gradle` file

```
implementation 'io.github.ajclopez:mongo-spring-search:1.0.4'
implementation 'io.github.ajclopez:mongo-spring-search:1.0.5'
````
## Usage
Converts query into a MongoDB query object.
```java
MongoSpringSearch.mss(String query)
MongoSpringSearch.mss(String query);
MongoSpringSearch.mss(String query, Optional<Configuration> configuration)
MongoSpringSearch.mss(String query, Optional<Configuration> configuration);
```

##### Arguments
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.github.ajclopez</groupId>
<artifactId>mongo-spring-search</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
<packaging>jar</packaging>

<name>mongo-spring-search</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package io.github.ajclopez.mss.criteria;

import java.util.Map;

import org.springframework.data.mongodb.core.query.Criteria;

import io.github.ajclopez.mss.QueryBaseVisitor;
import io.github.ajclopez.mss.model.CastType;
import io.github.ajclopez.mss.model.LogicalOperation;
import org.springframework.data.mongodb.core.query.Criteria;

import java.util.Map;

/**
*
Expand Down Expand Up @@ -84,6 +83,7 @@ public Criteria visitCriteria(io.github.ajclopez.mss.QueryParser.CriteriaContext
}

String expression = String.format("%s%s%s", keyContext.getText().trim(), opContext.getText().trim(), valueContext.getText().trim());
expression = expression.replace("+", "%2B");
io.github.ajclopez.mss.model.SearchCriteria criteria = io.github.ajclopez.mss.parser.QueryParser.criteriaParser(expression, casters);

return CriteriaImpl.buildCriteria(criteria);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package io.github.ajclopez.mss;
package io.github.ajclopez.mss.model;

import org.junit.Assert;
import org.junit.Test;

import io.github.ajclopez.mss.model.SearchCriteria;
import io.github.ajclopez.mss.model.SearchOperation;
import io.github.ajclopez.mss.parser.QueryParser;

public class SearchCriteriaTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package io.github.ajclopez.mss;
package io.github.ajclopez.mss.parser;

import io.github.ajclopez.mss.model.CastType;
import io.github.ajclopez.mss.model.SearchCriteria;
import io.github.ajclopez.mss.parser.QueryParser;
import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.ajclopez.mss;
package io.github.ajclopez.mss.pattern;

import io.github.ajclopez.mss.pattern.SearchPatterns;
import org.junit.Assert;
import org.junit.Test;

Expand Down

0 comments on commit deb6735

Please sign in to comment.