diff --git a/backend/src/schema/resolvers/searches.js b/backend/src/schema/resolvers/searches.js index 1b9bd3870..5316ccd9a 100644 --- a/backend/src/schema/resolvers/searches.js +++ b/backend/src/schema/resolvers/searches.js @@ -8,11 +8,10 @@ export default { // see http://lucene.apache.org/core/8_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description const myQuery = query .replace(/\s+/g, ' ') - .replace(/[[@#:*~\\$|^\]?/"'(){}+?!,.-]/g, '') + .replace(/[[@#:*~\\$|^\]?/"'(){}+?!,.-;]/g, '') .split(' ') .map(s => (s.toLowerCase().match(/^(not|and|or)$/) ? '"' + s + '"' : s + '*')) .join(' ') - // console.log(myQuery) const postCypher = ` CALL db.index.fulltext.queryNodes('post_fulltext_search', $query) YIELD node as resource, score @@ -73,36 +72,3 @@ export default { }, }, } - -/* order users by closest geolocation could look like this - -MATCH (u1:User { id: $thisUserId })-[:IS_IN]->(l1:Location) -MATCH (u2:User)-[:IS_IN]->(l2:Location) -WHERE NOT(u2.id = $thisUserId) -AND NOT (u2.deleted = true OR u2.disabled = true -OR (u1)-[:BLOCKED]-(u2)) -WITH point({longitude: l1.lng, latitude: l1.lat}) AS P1, -point({longitude: l2.lng, latitude: l2.lat}) AS P2, -u2 AS otherUsers -WITH distance(P1, P2) AS Distance, -otherUsers AS users -ORDER BY Distance -RETURN users - -*/ - -/* This query is to test if the calculation of distances works. -See: -https://github.com/Human-Connection/Human-Connection/issues/2587 - -MATCH (u1:User { name: 'Huey' })-[:IS_IN]->(l1:Location) -MATCH (u2:User)-[:IS_IN]->(l2:Location) -WHERE NOT(u2.name = 'Huey') -WITH point({longitude: l1.lng, latitude: l1.lat}) AS P1, -point({longitude: l2.lng, latitude: l2.lat}) AS P2, -l1.name AS Location1, l2.name AS Location2 -WITH distance(P1, P2) AS Distance, -Location1 AS Location1, Location2 AS Location2 -ORDER BY Distance -RETURN Location1, Location2, Distance -*/ diff --git a/webapp/components/features/SearchResources/SearchResources.spec.js b/webapp/components/features/SearchResources/SearchResources.spec.js index ee53e14dd..f09e21274 100644 --- a/webapp/components/features/SearchResources/SearchResources.spec.js +++ b/webapp/components/features/SearchResources/SearchResources.spec.js @@ -52,7 +52,7 @@ describe('SearchResources.vue', () => { }) it('clears searchResults', () => { - expect(wrapper.find('.is-open').exists()).toBe(false) + expect(wrapper.vm.searchResults).toEqual([]) }) it('set pending to false', () => { diff --git a/webapp/components/generic/SearchPost/SearchPost.spec.js b/webapp/components/generic/SearchPost/SearchPost.spec.js index 148d34441..a945444c7 100644 --- a/webapp/components/generic/SearchPost/SearchPost.spec.js +++ b/webapp/components/generic/SearchPost/SearchPost.spec.js @@ -37,26 +37,24 @@ describe('SearchPost.vue', () => { wrapper .find('.search-post-meta') .findAll('span') - .at(0) - .text(), - ).toMatch('3') + .filter(item => item.text() === '3') + .exists(), + ).toBe(true) }) it('renders post shoutedCount', () => { expect( wrapper .find('.search-post-meta') .findAll('span') - .at(1) - .text(), - ).toMatch('6') + .filter(item => item.text() === '6') + .exists(), + ).toBe(true) }) it('renders post author', () => { - expect( - wrapper - .find('.search-post-author') - .text() - .replace(/\s+-\s+/, ' '), - ).toMatch('Post Author 23.08.2019') + expect(wrapper.find('.search-post-author').text()).toContain('Post Author') + }) + it('renders post createdAt', () => { + expect(wrapper.find('.search-post-author').text()).toContain('23.08.2019') }) }) }) diff --git a/webapp/components/generic/SearchPost/SearchPost.vue b/webapp/components/generic/SearchPost/SearchPost.vue index 4c43c58d2..3da6056ba 100644 --- a/webapp/components/generic/SearchPost/SearchPost.vue +++ b/webapp/components/generic/SearchPost/SearchPost.vue @@ -7,12 +7,12 @@ @@ -58,9 +58,14 @@ export default { vertical-align: sub; } } -.post-shouted { +.shouted-count { width: 36px; display: inline-block; text-align: right; + font-weight: $font-weight-bold; +} +.comments-count { + text-align: right; + font-weight: $font-weight-bold; }