Commit Graph

21 Commits

Author SHA1 Message Date
Krzysztof Kotlarek 72cdd8d415
FIX: ignore category filter when incorrect param (#59)
Category filter accepts ids of categories. If value is manipulated, we should ignore it.
2021-09-27 14:52:27 +10:00
Osama Sayegh 312cafe9d7
DEV: Compatibility with Discourse on Rails 6.1 (#41)
Related to https://github.com/discourse/discourse/pull/12688.

The tags and categories count queries are failing on Rails 6.1 with `ERROR:  column "topics.bumped_at" must appear in the GROUP BY clause or be used in an aggregate function`. The reason these queries didn't fail prior to 6.1 was because Active Record would automatically drop the `ORDER BY` clause from the queries when we called `count` on them. This behavior has been [changed](5812feffe3) in 6.1 so now Active Record only drops the `ORDER BY` clause if there is no `GROUP BY` clause. Our queries do have `GROUP BY` clauses, so we need to drop the `ORDER BY` clauses ourselves before we call `count` to make them work on 6.1.
2021-04-15 19:17:26 +03:00
Justin DiRose f32aebdba0
FEATURE: Rename from Knowledge Explorer to Docs (#27)
After internal discussion, the team decided to rename this plugin to `discourse-docs`. No substantial changes made here aside from a settings migration.
2021-01-18 10:38:09 -06:00
Justin DiRose 63a8181fa4
FIX: Results count not always properly shown (#21)
There was a weird case where when filtering topics by solved status did not properly show the count of filtered topics. I took this opportunity to lightly refactor the backend. There was a duplicate size operation when we searched and when calculating pagination. I've eliminated the second size call and refactored the front end to be a little bit simpler while solving the bug.
2020-12-01 13:51:42 -06:00
Justin DiRose 0e610cf504
FIX: Show muted topics (#19)
In many cases it makes sense to show muted topics in the Knowledge Explorer view. One such case might be if a user mutes a documentation category, but wants to be able to search them via this plugin.

To implement this, I've called TopicQuery.default_results via an added class method, which does the same thing as latest_results except skips the muted topics removal.

One issue I ran into with this is with the no_definitions option set to true, the query was not able to see the categories table. This appears to work correctly in core as I dug into it, but was not able to root out the source of the issue in the plugin. Everything seems to be generated correctly compared to how core methods use TopicQuery, but this issue remained. This is the reason for the results.references(:categories) call on line 25 of query.rb, as then the query can properly access the categories table.
2020-11-16 13:43:48 -06:00
Justin DiRose 6e974250f9
FIX: Sort query was ambiguous (#15)
After implementing changes to tagging, this introduced ambiguity in the SQL query for sorting by activity. This commit fixes the ambiguity by explicitly defining the table from where the columns are used. Also adds tests to check for regressions in the future.
2020-11-04 16:46:55 -06:00
Justin DiRose 7959355159
FIX: Query name collision with multiple filters (#12)
If using more than two tags to filter, we'd run into an SQL alias
collision on a few joins. Resolved by ensuring unique names are used across the query.
2020-10-14 09:27:19 -05:00
Justin DiRose 14861e3321
FEATURE: Move route to /docs
After further discussion about the route, we landed on /docs as a better
choice. This commit makes that change.
2020-07-14 10:07:18 -05:00
Justin DiRose 25ca793555
FEATURE: Move to '/e'
'/knowledge-explorer' was proving a bit too verbose, so we're changing
it to '/e'. The former route should redirect to the new one.
2020-07-13 10:23:21 -05:00
Justin DiRose 9cd93e57d6
PERF: Use DB to ennumerate full results count 2020-06-16 15:51:15 -05:00
Justin DiRose 90f8bdf945
PERF: Use DB for topic enumeration tasks (#7)
Use SQL statements versus loading topics into memory to allow handling of large datasets.
2020-06-16 13:20:08 -05:00
Justin DiRose 6eb3c7574d
FEATURE: Filter by solved 2020-06-15 14:16:57 -05:00
Justin DiRose caa15f3567
FIX: Do not return restricted tags without access 2020-06-10 16:30:30 -05:00
Sam Saffron 80da6a5620 FEATURE: search entire knowledge base body as well as title
Previously search was only searching through the title of topics

This introduces full text search.

It also means we get automatic stemming which gives far better results.
2020-02-07 11:53:13 +11:00
Justin DiRose 1dd582e1b1 FEATURE: Sorting per column on topic list 2019-11-18 11:03:49 -06:00
Sam Saffron f8832f209c FIX: Core changed internals and now topics is not implicit
Be explicit about the name of the table we are using, multiple tables may
have the category_id column
2019-11-14 13:15:00 +11:00
Justin DiRose a6ac97e69f FIX: Stop loading more if initial topic list less than limit
In cases where the initial topic list is less than 30 and the viewport
is short enough to scroll, an additional set of topics would load. This
commit prevents a load more link from being generated in those
instances.
2019-11-08 10:46:41 -06:00
Justin DiRose 10ec8b47a8 FEATURE: Category filtering 2019-11-06 11:27:30 -06:00
Justin DiRose a34e4468c1
REFACTOR: Handle queries in more robust, customizable way
* Create custom query lib file

* Get topic list by category

* Get topic list with both categories and tags

* Count tags and pass back to controller in object

* Filter topic list by param-passed tag list

* FIX: Correctly serialize topic list data

* Filter results by search term (title only

* Debug commit

* Working multi-tag filtering

* FIX: case insensitive search terms

* Begin refactor of front end for new api changes

* REFACTOR: Use model for refreshing data
Instead of just using a route, which introduces full page refreshes, use
the route to pull the data initially, then update it using a model as to
refresh only the relevant parts of the page.

* Working topic load

* FIX: Visual alignment

* Refactor tests to follow new patterns

* Fixes suggested by eviltrout

* FEATURE: Load more topics

* FIX: Paginate records on return to the front end in a better fashion

* FIX: Prevent loadMore while loading more

* Fix pagination of topics to truncate list properly

* Inherit rubocop from discourse

* Make rubocop happynated

* Set list to unordered
2019-10-31 15:09:50 -05:00
Justin DiRose 5d0da1fe0a Spec tests & minor refactors 2019-10-02 16:24:40 -05:00
Justin DiRose 1789bac0cf FEATURE: Render Topics from Selected Categories/Tags on `/knowledge-explorer`
Add category/tag settings

Rename to knowledge explorer

Missed rename

Render a deduplicated list of topics from all selected tags and categories

Exclude category topic ids from rendered list
2019-06-28 14:56:04 -05:00