Commit Graph

235 Commits

Author SHA1 Message Date
Kasia Bułat
b71cf6d422 FEATURE: Add search not operator for tags. 2018-07-03 15:57:34 +08:00
Sam
5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
Guo Xiang Tan
ad5082d969 Make rubocop happy again. 2018-06-07 13:28:18 +08:00
Sam
e501936405 FIX: search server side error in rare condition 2018-05-28 15:28:18 +10:00
Sam
c677877e4f FIX: Korean needs no word segmentation 2018-05-28 09:37:57 +10:00
Sam
858a266031 FIX: exact matching should also match on title 2018-05-08 15:59:03 +10:00
Régis Hanol
a98aae3bcd FIX: topic search wasn't working for unlisted topics 2018-05-07 11:43:55 +02:00
Guo Xiang Tan
0d74c30fa7 Remove more uses of rescue nil. 2018-05-07 11:38:23 +08:00
Sam
86d12bd44b FEATURE: search within title using in:title
Also

- Significantly improved search ranking, title is treated most strongly
- Adds tag names to the index
- Run search re-indexer more aggressively
- Re-index topic and all posts on category change
2018-02-20 14:41:21 +11:00
Arpit Jalan
79eb9d7086 FEATURE: show header search results on search log term details page 2018-01-17 12:47:16 +05:30
Arpit Jalan
ff6dda85b7 FIX: replace curly quotes to regular quotes in search terms 2017-12-12 11:17:28 +05:30
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Régis Hanol
8ed318c4fe display 'similar to' earlier when composing a post 2017-09-16 01:03:29 +02:00
Neil Lalonde
2c56f8df7c FEATURE: show tags in search results 2017-08-25 11:52:59 -04:00
Erick Guan
6e59149a77 FIX: rebuild index when engine replaced (#5021) 2017-08-16 07:38:34 -04:00
Sam
97fa64d846 FIX: non tag/category # searches should be passed through 2017-08-01 18:15:14 -04:00
Neil Lalonde
1fdf2e4d4b badly resolved conflicts 2017-07-31 20:28:16 -04:00
Neil Lalonde
fa3c240e8b Merge pull request #4981 from dmacjam/fix_limited_search_results
FIX: limited search results
2017-07-31 20:23:57 -04:00
Neil Lalonde
7c1d7fb423 Merge branch 'master' into fix_limited_search_results 2017-07-31 15:55:31 -04:00
Erick Guan
f1eccd113c Replace rmmseg gem for cppjieba_rb since better dictionary (#5006)
* Rename locale to ts config in search module to make it clear

* Replace rmmese-cpp for cppjieba_rb
2017-07-31 15:28:48 -04:00
Neil Lalonde
83011045c8 fix rubocop offenses 2017-07-31 11:59:16 -04:00
Neil Lalonde
5d528f0d15 Merge pull request #4958 from dmacjam/search_posts_by_filetype
FEATURE: Search posts by filetype
2017-07-31 11:55:34 -04:00
Neil Lalonde
4a5907b116 Merge branch 'master' into search_posts_with_images 2017-07-31 10:44:41 -04:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Neil Lalonde
ea0e90b2b0 Merge branch 'master' into search_posts_with_images 2017-07-26 10:15:55 -04:00
Guo Xiang Tan
e3ac6585bd FIX: Search by topic_id should not be restricted by SiteSetting.min_search_term_length. 2017-07-26 09:52:39 +09:00
Neil Lalonde
d8c27e3871 Merge branch 'master' into search_posts_by_filetype 2017-07-25 14:41:20 -04:00
Jakub Macina
e5ee4ccc48 Add pagination and checking for more results to search. 2017-07-20 18:12:34 +02:00
Robin Ward
21e02d6969 Include the search_log_id in search results 2017-07-17 12:10:32 -04:00
Robin Ward
97e211f837 FEATURE: Log Search Queries 2017-07-14 14:30:58 -04:00
Jakub Macina
677267ae78 Add onceoff job for uploads migration of column extension. Simplify filetype search and related rspec tests. 2017-07-12 17:19:27 +02:00
Jakub Macina
8c445e9f17 Fix backend code for searching by a filetype as a combination of uploads and topic links. Add rspec test for extracting file extension in upload. 2017-07-06 19:19:31 +02:00
Guo Xiang Tan
7ed9fbb415 FIX: Use default parameter in method. 2017-06-26 11:14:13 +09:00
Robin Ward
aaaa93c216 FIX: Full page search was removing advanced search terms 2017-06-21 15:51:15 -04:00
Jakub Macina
f87d32ac6d Add backend code for searching by filetypes. 2017-06-20 21:20:06 +02:00
Jakub Macina
bf002e0873 Add extraction of image_url for oneboxed images. Fix search by images filter name. 2017-06-19 15:18:02 +02:00
Neil Lalonde
b98a930364 Merge pull request #4896 from dmacjam/multiple-tags-logical-and-search
FEATURE: Advanced search supports logical AND of multiple tags
2017-06-14 14:39:23 -04:00
Jakub Macina
76712da166 Add backend code for searching posts with images. 2017-06-09 10:30:21 +02:00
Guo Xiang Tan
684b05f510 FIX: Strip zero-width characters from search terms. 2017-06-07 18:19:47 +09:00
Arpit Jalan
a1ebd67237 Revert "FEATURE: new setting to prioritize open topics in search" 2017-06-03 01:54:35 +05:30
Arpit Jalan
b8a87a0996 FEATURE: new setting to prioritize open topics in search 2017-06-03 00:33:53 +05:30
Jakub Macina
eaec35d230 Fix tag related advanced search tests into one context. Fix dynamic locale and select clause in search by all tags. Fix separator for all tags to plus sign. 2017-06-02 12:39:07 +02:00
Guo Xiang Tan
13c6695d65 Revert "Load posts in batches while indexing problem posts."
This reverts commit ce57ff9fcf.

Limit is ignored with `find_each`.
2017-06-01 11:15:27 +09:00
Jakub Macina
3eebcccbf2 Add searching by all tags using postgres full-text search. 2017-05-31 16:36:15 +02:00
Guo Xiang Tan
137f91d1cf PERF: N+1 query when searching with tags enabled. 2017-05-31 08:14:09 +09:00
Guo Xiang Tan
ce57ff9fcf Load posts in batches while indexing problem posts. 2017-05-31 07:54:49 +09:00
Sam
f12490eae0 FIX: order:latest not working for search within topic
FEATURE: use 'l' as a shorthand for order:latest
2017-05-24 11:24:41 -04:00
Sam
52ae63d5d7 FIX: when searching PMs also search group PMs
Users belonging to a group could not search for PMs unless explicitly added
to the PM unless admin
2017-05-11 15:59:03 -04:00
Yana Agun Siswanto
cd2d2f16e5 Allow to order search results by the topic creation date
based on: https://meta.discourse.org/t/allow-to-order-search-results-by-the-topic-creation-date/38544
2017-03-30 01:18:38 +07:00
Sam
6ebddc42d1 FIX: include children categories when searching a category 2017-03-10 15:58:47 -05:00
Guo Xiang Tan
c623951306 FEATURE: Search can be scoped to posts that the current user has seen/unseen.
https://meta.discourse.org/t/advanced-search-posts-that-i-have-seen/57966
2017-03-09 01:01:33 +08:00
Guo Xiang Tan
10ec554d97 Ensure we escape variables passed into our SQL query. 2017-03-08 20:37:59 +08:00
Sam Saffron
df8f365d99 FEATURE: improve search so it searches sub categories by default
If you want an exact category match use `category:=howto` or `#=howto"
2017-02-07 15:53:37 -05:00
Sam
0a78ae739d Remove SearchObserver, aim is to remove all observers
rails-observers gem is mostly unmaintained and is a pain to carry forward
new implementation contains significantly less magic as a bonus
2016-12-22 13:13:14 +11:00
Sam
0631a84ca0 Merge pull request #4576 from cpradio/min-posts-search
FEATURE: Add min_post_count search filter
2016-11-29 10:19:33 +11:00
cpradio
66ca6d622e FEATURE: Add min_post_count search filter 2016-11-28 11:43:12 -05:00
Sam
bc6ee85850 FIX: stop caching locale cause it bleeds in multisite 2016-11-25 11:35:29 +11:00
Sam Saffron
647ee46edf FIX: don't stem the search term
Search for "canned" not working correctly and "butted", "ands" and many more :)
2016-10-07 12:40:57 +11:00
Robin Ward
b4b96bf62b FIX: Support searching your PMs via full page 2016-08-19 15:00:05 -04:00
Robin Ward
ec8622a860 FIX: Count the records added, including duplicates 2016-08-12 17:18:12 -04:00
Robin Ward
11939fa8b9 PERF: Avoid some more count queries when fetching more results 2016-08-12 13:05:09 -04:00
Sam
8a792508e9 PERF: improve offset discovery query 2016-08-12 14:36:38 +10:00
Robin Ward
431c211ec2 Bump search post id cache to 1 week 2016-08-11 14:06:07 -04:00
Robin Ward
35922bf692 Use unscoped instead of with_deleted 2016-08-11 13:12:59 -04:00
Robin Ward
7e165d031b FIX: Short terms will be searched for if at least one is long enough 2016-08-11 11:53:14 -04:00
Robin Ward
4bb6f88181 FIX: Bump up backfill size to 50 2016-08-10 17:51:29 -04:00
Robin Ward
c1cd9e0647 PERF: For estimates, we don't need to worry about deleted 2016-08-10 17:25:34 -04:00
Robin Ward
fc311dbe3b FEATURE: An option to search more recent posts for very large sites.
On very large forums searching posts can be slow, so this commit
introduces the ability to try and search only the most recent posts
first, and then going for a larger breadth search if there aren't
enough results.

Enable `search_prefer_recent_posts` and you can customize how many
recent posts to filter with `search_recent_posts_size`
2016-08-10 15:43:42 -04:00
Robin Ward
cc366d5a60 FIX: Search in non-english should have a smaller minimum 2016-08-09 15:20:28 -04:00
Robin Ward
28436a604a FIX: Prevent tricking the search from ignoring minimum lengths 2016-08-09 14:49:46 -04:00
Robin Ward
c1125c8649 PERF: Use simpler serializer for search, eager load post users 2016-08-09 14:49:46 -04:00
Sam
e01802a13b FIX: strip quote from search term when searching within topic 2016-07-25 15:06:25 +10:00
Robin Ward
b9df18360d If you search a category by id, also include its children 2016-06-08 13:50:52 -04:00
Arpit Jalan
a166869d67 FEATURE: search fallback to tags when category not found 2016-06-02 18:14:41 +05:30
Neil Lalonde
f13470b96b Use db schema for tags instead of plugin store and custom fields 2016-05-26 14:29:48 -04:00
Arpit Jalan
5b030017d9 FEATURE: new search filter in:wiki 2016-05-13 13:56:53 +05:30
Arpit Jalan
00893ef1de FEATURE: new search filter - @username 2016-05-12 14:26:26 +05:30
Arpit Jalan
2e0350ee74 FEATURE: new search filter - #category-slug 2016-05-11 15:37:27 +05:30
Mittineague
66fb02acad Permit in topic search when full name is null (#4217)
* Permit in topic search when full name is null

* as per @gschlager  and  @ZogStriP pull 4217
2016-05-09 22:20:35 +02:00
Neil Lalonde
e5918c7d00 FEATURE: Merge tagging plugin into core 2016-04-27 11:58:53 -04:00
Sam
77242e4680 FEATURE: in:pinned and in:unpinned search filters 2016-03-18 16:26:54 +11:00
Sam Saffron
e00850a1ab FEATURE: implement before and after filters in search remove max_age and min_age
supports

- before:monday
- after:june
- before:2001
- before:2001-01-22
2016-03-14 23:27:02 +11:00
Sam Saffron
4be8de21a1 FIX: not searching group messages when searching private 2015-12-15 13:26:35 +11:00
Sam
f74a6457ee FEATURE: allow CJK to be tokenized in non CJK sites.
Meaning a mixed English/Chinese site can still have a functioning search.
2015-11-27 16:35:27 +11:00
Régis Hanol
8ba5397f0d can't find staged users with search 2015-11-18 21:06:59 +01:00
Régis Hanol
7e255a151b PERF: only use fulltext when searching for a user (I checked, it's enough) 2015-11-04 23:04:37 +01:00
Régis Hanol
bb79e6aff7 FEATURE: new hide_user_profiles_from_public site setting 2015-10-28 19:56:08 +01:00
Robin Ward
46bef4fad0 FIX: Allow mods/admins to search whispers 2015-09-25 11:43:04 -04:00
Sam
61ceaef4e5 FIX: allow ordering for term-less queries 2015-09-21 07:59:52 +10:00
Sam
681334701d FIX: Stop aggregating likes 2015-09-18 17:50:15 +10:00
Sam
664e2209e5 FIX: order latest was broken 2015-09-18 17:16:53 +10:00
Robin Ward
23646494eb FIX: Don't return alternative post types in search queries 2015-09-16 14:51:20 -04:00
Sam
a7b34cd16b rename to badge, better more consistent name 2015-09-16 08:51:28 +10:00
Sam
6496895096 FEATURE: search for all posts by a group 2015-09-15 17:39:14 +10:00
Sam
17d999ab12 FEATURE: search for all posts of users that have a badge
with_badge:"badge name" will allow you to search only
posts of users with a particular badge
2015-09-15 17:22:08 +10:00
Sam
b38a1309f7 FIX: add more quoting to avoid invalid terms 2015-08-19 09:27:47 +10:00
Sam
ad2de1804e Correct bad where clause when no category/user found 2015-08-14 11:53:16 +10:00
Sam
ecac786f86 FIX: remove invalid chars from ts_query helper 2015-08-13 17:55:10 +10:00
Sam
139314c213 FIX: search for 1.5 etc was broken
FEATURE: search by exact phrase

Use PG tokenizer to split up search phrase instead of relying on Ruby code
This produces much more accurate tokenization
2015-08-10 17:41:14 +10:00
Sam
41ceff8430 UX: move search to its own route
previously search was bundled with discovery, something that makes stuff confusing internally
2015-07-27 16:47:06 +10:00