Skip to content

Commit

Permalink
Merge pull request #125 from rwth-acis/develop
Browse files Browse the repository at this point in the history
Release v0.9.2 - Project search fixed
  • Loading branch information
fxjordan authored Nov 16, 2021
2 parents 68fa4a5 + b89ae56 commit 5260a0d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ the [GitHub Release Page](https://github.com/rwth-acis/RequirementsBazaar/releas

## [Unreleased]

## [0.9.2] - 2021-11-16

### Changed

- Fixed project search API which did not return projects for incomplete words
[#121](https://github.com/rwth-acis/RequirementsBazaar/pull/124)

## [0.9.1] - 2021-09-26

### Changed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.parallel=true
java.version=14
core.version=1.1.2
service.version=0.9.1
service.version=0.9.2
service.name=de.rwth.dbis.acis.bazaar.service
service.class=BazaarService
jooq.version=3.14.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,18 @@ public Condition getSearchCondition(String search) throws Exception {
return PROJECT.NAME.likeIgnoreCase("%");
}
return DSL.condition("to_tsvector({0} || {1}) @@ websearch_to_tsquery({2})",
PROJECT.NAME, PROJECT.DESCRIPTION, search);
PROJECT.NAME, PROJECT.DESCRIPTION, search)
/*
* Workaround: ts_vector based search only works on full words that also
* need to be recognized by an internal english dictionary.
*
* This simple addition enables simple substring based autocomplete
* search while keeping the ts_vector based search for project descriptions.
*
* At some point we should think about a better search solution like
* Elasticsearch for the whole system.
*/
.or(PROJECT.NAME.likeIgnoreCase("%" + search + "%"));
}

@Override
Expand All @@ -220,7 +231,7 @@ public Collection<? extends Condition> getFilterConditions(Map<String, String> f
} else if (filterEntry.getKey().equals("following")) {
conditions.add(
PROJECT.ID.in(
DSL.<Integer>select(PROJECT_FOLLOWER_MAP.PROJECT_ID)
DSL.select(PROJECT_FOLLOWER_MAP.PROJECT_ID)
.from(PROJECT_FOLLOWER_MAP)
.where(PROJECT_FOLLOWER_MAP.USER_ID.eq(Integer.parseInt(filterEntry.getValue())))
)
Expand Down

0 comments on commit 5260a0d

Please sign in to comment.