Skip to content

Commit 5260a0d

Browse files
authored
Merge pull request #125 from rwth-acis/develop
Release v0.9.2 - Project search fixed
2 parents 68fa4a5 + b89ae56 commit 5260a0d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ the [GitHub Release Page](https://github.com/rwth-acis/RequirementsBazaar/releas
1010

1111
## [Unreleased]
1212

13+
## [0.9.2] - 2021-11-16
14+
15+
### Changed
16+
17+
- Fixed project search API which did not return projects for incomplete words
18+
[#121](https://github.com/rwth-acis/RequirementsBazaar/pull/124)
19+
1320
## [0.9.1] - 2021-09-26
1421

1522
### Changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
org.gradle.parallel=true
22
java.version=14
33
core.version=1.1.2
4-
service.version=0.9.1
4+
service.version=0.9.2
55
service.name=de.rwth.dbis.acis.bazaar.service
66
service.class=BazaarService
77
jooq.version=3.14.4

reqbaz/src/main/java/de/rwth/dbis/acis/bazaar/service/dal/transform/ProjectTransformer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,18 @@ public Condition getSearchCondition(String search) throws Exception {
202202
return PROJECT.NAME.likeIgnoreCase("%");
203203
}
204204
return DSL.condition("to_tsvector({0} || {1}) @@ websearch_to_tsquery({2})",
205-
PROJECT.NAME, PROJECT.DESCRIPTION, search);
205+
PROJECT.NAME, PROJECT.DESCRIPTION, search)
206+
/*
207+
* Workaround: ts_vector based search only works on full words that also
208+
* need to be recognized by an internal english dictionary.
209+
*
210+
* This simple addition enables simple substring based autocomplete
211+
* search while keeping the ts_vector based search for project descriptions.
212+
*
213+
* At some point we should think about a better search solution like
214+
* Elasticsearch for the whole system.
215+
*/
216+
.or(PROJECT.NAME.likeIgnoreCase("%" + search + "%"));
206217
}
207218

208219
@Override
@@ -220,7 +231,7 @@ public Collection<? extends Condition> getFilterConditions(Map<String, String> f
220231
} else if (filterEntry.getKey().equals("following")) {
221232
conditions.add(
222233
PROJECT.ID.in(
223-
DSL.<Integer>select(PROJECT_FOLLOWER_MAP.PROJECT_ID)
234+
DSL.select(PROJECT_FOLLOWER_MAP.PROJECT_ID)
224235
.from(PROJECT_FOLLOWER_MAP)
225236
.where(PROJECT_FOLLOWER_MAP.USER_ID.eq(Integer.parseInt(filterEntry.getValue())))
226237
)

0 commit comments

Comments
 (0)