Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/class_name/name/g #1

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
268f8bd
s/class_name/name/g
xfalcox Apr 26, 2024
55db6f1
Move posts and chats to raw, small fixes for old bad data
xfalcox Apr 26, 2024
3982d4e
FIX: Broken links
keegangeorge Apr 26, 2024
e57c2fd
FIX: Posts links
keegangeorge Apr 26, 2024
a46da51
UX: improve search layout and styles, grid user results
awesomerobot Apr 26, 2024
42f928e
Merge remote-tracking branch 'refs/remotes/origin/experimental' into …
awesomerobot Apr 26, 2024
a01841f
lint fix
awesomerobot Apr 26, 2024
eec5d35
DEV: `cooked` to `raw`, add tags to UI, and hide `users` sort
keegangeorge Apr 26, 2024
fd91de8
Merge branch 'experimental' of https://github.com/discourse/discourse…
keegangeorge Apr 26, 2024
804c5a3
FIX: Sort mode persisting results
keegangeorge May 1, 2024
cdb3452
DEV: Previous query pre-fills when switching sort modes
keegangeorge May 2, 2024
3ce6180
FEATURE: Add tags refinement list and...
keegangeorge May 2, 2024
81abee9
Many fixes
xfalcox May 6, 2024
1deb793
Fix event handling
xfalcox May 6, 2024
556222f
Make rake task able to recover better from last id
xfalcox May 6, 2024
6ecf264
Make posts the default search
xfalcox May 7, 2024
a063e96
Add basic constructs for semantic search
xfalcox May 7, 2024
c8e4809
Optionally proxy typesense via Rails middleware
xfalcox May 8, 2024
3edd2ae
DEV: Add search modes
keegangeorge May 8, 2024
9ea26ab
Index PMs
xfalcox May 8, 2024
2437e87
Working semantic / hybrid ./ hyde search
xfalcox May 9, 2024
a3f7531
Chat Threads have titles not names
xfalcox May 9, 2024
cf21765
Skip chat messages from deleted users
xfalcox May 9, 2024
3b083f6
https support on proxy middleware
xfalcox May 9, 2024
f866dbf
username not names for users
xfalcox May 9, 2024
3ef5051
Rescue errors on rake task
xfalcox May 9, 2024
8173393
UX: Topic/PM refinement list and conditional refinements
keegangeorge May 9, 2024
38a7743
DEV: Add `allowed_users` `allowed_groups` refinement lists
keegangeorge May 9, 2024
986248f
UX: adjust positioning and styles for search, topic results
awesomerobot May 9, 2024
f2ddba1
DEV: Remove semantic/hyde options and apply `syntax_tree`
keegangeorge May 9, 2024
12201f5
UX: style user results as a table
awesomerobot May 9, 2024
fb26096
Move topics to default
xfalcox May 10, 2024
8bcee27
Change post query weights
xfalcox May 10, 2024
b5cc716
FIX: `.search()` call breaks show more results in hits
keegangeorge May 13, 2024
6f48631
FIX: Hyde/Hybrid/Semantic working
keegangeorge May 13, 2024
991a524
UX: style post results, add PM envelope to titles
awesomerobot May 14, 2024
55cb067
UX: improve styling and structure for chat results
awesomerobot May 14, 2024
c09bade
FIX: Embeddings should not be fetched again if load more is pressed
keegangeorge May 15, 2024
e870993
FIX: "Invalid Date" text appearing after two mins
keegangeorge May 15, 2024
c62d2e7
FIX: Error when opening filters after switching search type
keegangeorge May 15, 2024
2ef2273
DEV: Changing search mode re-triggers search
keegangeorge May 15, 2024
e8afc84
UX: lock icon for closed topic results
awesomerobot May 15, 2024
4b21a45
UX: include categories in controller so we can assign category badge …
awesomerobot May 15, 2024
c19e7fd
DEV: Syntax tree and avoid breaking when color missing
keegangeorge May 15, 2024
158f399
UX: Use dimmer highlight color for search highlight
keegangeorge May 15, 2024
c79c3f9
Change embeddings table
xfalcox May 16, 2024
578941e
UX: Fix highlight dark mode colors
keegangeorge May 16, 2024
fd5a6b4
DEV: Separate modes wrapper
keegangeorge May 16, 2024
c75dbe8
DEV: Move `query` to service
keegangeorge May 16, 2024
0244c50
FIX: Linting
keegangeorge May 16, 2024
4a5dfb7
FIX: `searchType` typo, switch to constants
keegangeorge May 17, 2024
0afb51d
DEV: more constant
keegangeorge May 17, 2024
d06e46a
DEV: Bring back `sort_by` when returning to keyword search
keegangeorge May 17, 2024
8ac6eda
Hack for tag visibility
xfalcox May 22, 2024
8d71ad9
Hack for private tags also on topics / handle deleted topics posts
xfalcox May 27, 2024
f80f07e
Better task continuation detection
xfalcox May 27, 2024
d53a6cc
Handle unlisted topics
xfalcox May 29, 2024
75e44a3
Exclude staged users / update private tags hack
xfalcox Jun 5, 2024
e1b8f73
fix bugs
xfalcox Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/jobs/regular/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Index < ::Jobs::Base

def execute(args)
id = args[:id]
type = "::InstantSearch::Collections::#{args[:type]}".constantize
type = args[:type].constantize
object = type.model.find_by(id: id)

return unless object.present?
Expand Down
4 changes: 2 additions & 2 deletions lib/instant_search/collections/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(object)
end

def self.model
self.class_name.constantize
self.name.demodulize.constantize
end

def create
Expand Down Expand Up @@ -37,7 +37,7 @@ def self.default_sorting_field
end

def self.collection
self.class_name.demodulize.underscore.pluralize
self.name.demodulize.underscore.pluralize
end

def self.create_collection
Expand Down
6 changes: 3 additions & 3 deletions lib/instant_search/event_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module ::InstantSearch
class EventHandler
def self.setup(plugin)
::InstantSearch::Collections::Base.subclasses.each do |collection|
symbol_prefix = collection.class_name.underscore
symbol_prefix = collection.name.demodulize.underscore

%w[created edited].each do |action|
plugin.on("#{symbol_prefix}_#{action}".to_sym) do |target|
Jobs.enqueue(:index, id: target.id, type: collection.class_name, action: "upsert")
Jobs.enqueue(:index, id: target.id, type: collection.name, action: "upsert")
end
end

plugin.on("#{symbol_prefix}_destroyed".to_sym) do |target|
Jobs.enqueue(:index, id: target.id, type: collection.class_name, action: "delete")
Jobs.enqueue(:index, id: target.id, type: collection.name, action: "delete")
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/index.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ end
task "instant_search:index", %i[concurrency] => [:environment] do |_, args|
load!
InstantSearch::Collections::Base.subclasses.each do |collection|
puts "### Indexing #{collection.class_name}"
puts "### Indexing #{collection.name}"
i = 0
total = collection.model.count
queue = SizedQueue.new(50)
queue = SizedQueue.new(20)
Thread.new do
collection.model.find_in_batches { |batch| batch.each { |object| queue.push object } }
queue.push Parallel::Stop
Expand All @@ -26,10 +26,10 @@ task "instant_search:index", %i[concurrency] => [:environment] do |_, args|
ActiveRecord::Base.connection_pool.with_connection do
collection.new(item).create
i += 1
print "### Indexed #{i * 100 * args[:concurrency].to_i / total}% of #{collection.class_name} \r"
print "### Indexed #{i * 100 * args[:concurrency].to_i / total}% of #{collection.name} \r"
end
end
puts "### Indexed #{collection.class_name} done "
puts "### Indexed #{collection.name} done "
end
end

Expand Down