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

Refactor search engine into own endpoint #788

Merged
merged 125 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
77c29b3
this was fun
epugh Mar 27, 2023
ff41ca2
checkpoint
epugh Mar 30, 2023
be854c5
Merge branch 'main' into look_at_better_screen_layout
epugh Jun 4, 2023
265251c
bump to next version of bootstrap
epugh Jun 5, 2023
95128c4
Update package.json
epugh Jun 5, 2023
c69b932
first cut
epugh Jun 5, 2023
db930f2
mocking stuff out
epugh Jun 6, 2023
b93a4d9
flesh out the home page a bit
epugh Jun 6, 2023
41c00cc
lots of progress
epugh Jun 6, 2023
c2edacd
fix test
epugh Jun 6, 2023
d0eff85
a bit better
epugh Jun 6, 2023
e3058d4
Merge branch 'main' into look_at_better_screen_layout
epugh Jul 26, 2023
b75d856
a table!
epugh Jul 26, 2023
753ca07
check point progress in spark line!
epugh Jul 26, 2023
19758c6
doh!
epugh Jul 26, 2023
e73ec84
working on case summary output
epugh Jul 26, 2023
b922002
progress
epugh Jul 27, 2023
4ab378c
Only return your cases that are not archived
epugh Jul 27, 2023
7385c37
reformatting...
epugh Jul 27, 2023
d75ecb3
experiment with flyout nav
epugh Jul 27, 2023
4ff0399
consistent ordering...
epugh Jul 27, 2023
eb4f79b
optimize sql
epugh Jul 27, 2023
99f231c
include capabara testing
epugh Jul 27, 2023
38c5aed
lint
epugh Jul 27, 2023
2c4c5da
need to keep our select.
epugh Jul 27, 2023
1a51b43
roll in some book data
epugh Jul 27, 2023
04c4874
Be more realistic dammit
epugh Aug 3, 2023
6e60d9a
rename variable
epugh Aug 3, 2023
517ed77
Introduce looking for when the score for a case changed, and then hig…
epugh Aug 3, 2023
d19d78b
lint
epugh Aug 3, 2023
a76aff2
smaller sidebar...
epugh Aug 4, 2023
b75a7f8
tweak the links ion sidebar
epugh Aug 4, 2023
d986ca9
use link_to
epugh Aug 4, 2023
9feceea
lint and get rid of unused sidebar
epugh Aug 4, 2023
f635c70
keep judgment screen simple
epugh Aug 4, 2023
6742850
show metrics for grouped cases...
epugh Aug 4, 2023
055e3c9
bit o fixing
epugh Aug 4, 2023
45d08b4
bit o clean up
epugh Aug 14, 2023
b4bc849
Update home_helper.rb
epugh Aug 14, 2023
13fa0c7
fixes
epugh Aug 15, 2023
c9567c6
handle redirecting users to the wizard
epugh Aug 15, 2023
853b0a8
unused route
epugh Aug 15, 2023
bcaa00e
we no longer have a "/" route since we have a proper home page for Qu…
epugh Aug 15, 2023
eea1f9f
proper handling
epugh Aug 15, 2023
bf14c1f
fixes
epugh Aug 15, 2023
0d55483
tweaks
epugh Aug 15, 2023
1255216
restore test, this mattered!
epugh Aug 16, 2023
7c88bd4
First steps to extracting the search engine into it's own object.
epugh Aug 17, 2023
e5694ed
now that we use fully qualified urls to bring up the core app, we don…
epugh Aug 17, 2023
30b7e02
Merge branch 'main' into refactor_search_engine_into_own_endpoint
epugh Aug 17, 2023
76832a0
progress
epugh Aug 17, 2023
9157925
bit o clean up so we don't issue queries to search engine till the pa…
epugh Aug 21, 2023
7c49352
fix ups
epugh Aug 21, 2023
6dade3d
how to fire up test environment in console
epugh Aug 21, 2023
4cbf2bb
improve api and models around search endpoints in rails
epugh Aug 23, 2023
881f5c7
Now have the admin side and the wizard...
epugh Aug 23, 2023
576f939
link to team
epugh Aug 23, 2023
a410e7a
Merge branch 'main' into refactor_search_engine_into_own_endpoint
epugh Sep 7, 2023
d5e3785
docs...
epugh Sep 7, 2023
22b03dc
fix tests
epugh Sep 7, 2023
dbe933b
better sample data and lint
epugh Sep 7, 2023
434d5f3
progress!
epugh Sep 8, 2023
1f62aca
Wedged in a "snapshot" search engine that lets you enter a snapshot a…
epugh Sep 9, 2023
aa28cbd
add a snapshot icon
epugh Sep 9, 2023
8dcfe7b
add more Solr simulated end points.
epugh Sep 9, 2023
5c7dbdd
so much good stuff for static indexes
epugh Sep 11, 2023
2157faf
restore this
epugh Sep 12, 2023
834f96b
Merge branch 'main' into refactor_search_engine_into_own_endpoint
epugh Sep 12, 2023
0cde137
fixing things after merge of vectara!
epugh Sep 12, 2023
3a7ba5a
fix the tests...
epugh Sep 12, 2023
9cf37d7
lint
epugh Sep 12, 2023
551aed5
formatting
epugh Sep 12, 2023
2f6259f
not needed.
epugh Sep 12, 2023
d0082de
be smarter about nils
epugh Sep 13, 2023
62a65da
clean up bogus tries
epugh Sep 13, 2023
fe55582
once more
epugh Sep 13, 2023
0c60368
once more
epugh Sep 13, 2023
cefe309
roll it
epugh Sep 13, 2023
32e4508
sigh
epugh Sep 13, 2023
b75d9cd
one last try
epugh Sep 13, 2023
949f6ee
skip the name
epugh Sep 13, 2023
64566f2
Mostly working devQueryParams..!
epugh Sep 13, 2023
1c53e20
okay, shits working
epugh Sep 14, 2023
0ccb45a
first cut
epugh Sep 14, 2023
8afd72c
lint
epugh Sep 14, 2023
76f0b5d
lint
epugh Sep 14, 2023
9a1bb60
update test now that we change how it worked..
epugh Sep 14, 2023
4eb957e
small clean up
epugh Sep 15, 2023
ccd42e5
deal with spaces in csv header file that sneak into our data!!!
epugh Sep 15, 2023
93df2d7
Getting away from me, but here is a searchapi end point...
epugh Sep 15, 2023
69fec8a
lint
epugh Sep 15, 2023
f366c1e
search api!
epugh Sep 18, 2023
04fd65b
Merge branch 'main' into refactor_search_engine_into_own_endpoint
epugh Sep 21, 2023
14278d9
Reworked the part of reusing an existing search end point. Also fixe…
epugh Sep 22, 2023
a693ba2
update tests to reflect removed parameter...
epugh Sep 22, 2023
340e9c2
lint
epugh Sep 22, 2023
0a8433c
fixes
epugh Sep 22, 2023
d1b69f8
bump splainer to support 'searchapi' endpoint ping function.
epugh Sep 22, 2023
6a44f7a
shrink what we need a bit...
epugh Sep 25, 2023
de9d5ac
lots of fixes to the flow...
epugh Sep 25, 2023
8586008
missing template for rendering links to teams.
epugh Sep 25, 2023
bc46520
better handling of the redirect to https or http messaging. Simplify…
epugh Oct 3, 2023
a3d94de
don't show so much detail.
epugh Oct 3, 2023
be6abd7
lots of fixes.
epugh Oct 4, 2023
dfafd86
fix tests and flows
epugh Oct 4, 2023
756c87d
add tests
epugh Oct 5, 2023
98b9146
didn't mean to cmmit
epugh Oct 5, 2023
7e7c090
logging not needed
epugh Oct 5, 2023
265544a
clean up variable names and be smarter on what toggles open and what …
epugh Oct 5, 2023
03466a4
Jan spotted the old logo!
epugh Oct 11, 2023
20ec79f
store these changes
epugh Oct 12, 2023
3e6c702
now with less party!
epugh Oct 12, 2023
ac26b86
oops
epugh Oct 12, 2023
e940f52
too noisy
epugh Oct 12, 2023
5fca5c8
surface if you are looking at archived or public case
epugh Oct 12, 2023
f3539b5
nicer docs
epugh Oct 14, 2023
0d51e4a
allow you to unshare as well as share. You could do this for a case,…
epugh Oct 14, 2023
484deb0
lots of fixes.
epugh Oct 14, 2023
3d9cf90
lint
epugh Oct 15, 2023
b6479ca
introduce the ability to archive a search end point...
epugh Oct 16, 2023
6648850
lint
epugh Oct 16, 2023
387ded3
restore the charset
epugh Oct 16, 2023
a1d3dd9
you can now archive a search endpoint FROM the angular app.
epugh Oct 16, 2023
f549f9d
Merge branch 'main' into refactor_search_engine_into_own_endpoint
epugh Oct 16, 2023
443e533
stuff
epugh Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
epugh committed Oct 16, 2023
commit 6648850fda65b5d2338ac50f5268f4a197b14e01
36 changes: 18 additions & 18 deletions app/controllers/api/v1/search_endpoints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ def index
bool = ActiveRecord::Type::Boolean.new
archived = bool.deserialize params[:archived]
puts "are we looking up archived? #{archived}"
query = current_user.search_endpoints_involved_with
if params[:team_id]
@search_endpoints = current_user.search_endpoints_involved_with
.where(archived: archived)
.joins(:teams).where(teams: {id: params[:team_id] })
else
@search_endpoints = current_user.search_endpoints_involved_with
.where(archived: archived)
end

current_user.search_endpoints_involved_with

@search_endpoints = if params[:team_id]
current_user.search_endpoints_involved_with
.where(archived: archived)
.joins(:teams).where(teams: { id: params[:team_id] })
else
current_user.search_endpoints_involved_with
.where(archived: archived)
end

respond_with @search_endpoints
end

def show
respond_with @search_endpoint
end

def update
update_params = search_endpoint_params
bool = ActiveRecord::Type::Boolean.new
Expand All @@ -35,15 +35,15 @@ def update
# archiving a case means current user takes it over, that should be better expressed.
@search_endpoint.owner = current_user
@search_endpoint.mark_archived!
#Analytics::Tracker.track_case_archived_event current_user, @case
# Analytics::Tracker.track_case_archived_event current_user, @case
respond_with @search_endpoint
elsif @search_endpoint.update update_params
#Analytics::Tracker.track_case_updated_event current_user, @case
# Analytics::Tracker.track_case_updated_event current_user, @case
respond_with @search_endpoint
else
render json: @search_endpoint.errors, status: :bad_request
end
end
end

private

Expand All @@ -53,10 +53,10 @@ def set_search_endpoint

render json: { error: 'Not Found!' }, status: :not_found unless @search_endpoint
end

def search_endpoint_params
params.require(:search_endpoint).permit(:archived)
end
end
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/search_endpoints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def set_search_endpoint
end

def search_endpoint_params
params.require(:search_endpoint).permit(:name, :endpoint_url, :search_engine, :custom_headers, :api_method, :archived,
team_ids: [])
params.require(:search_endpoint).permit(:name, :endpoint_url, :search_engine, :custom_headers,
:api_method, :archived, team_ids: [])
end
end
3 changes: 3 additions & 0 deletions app/models/judgement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class Judgement < ApplicationRecord
belongs_to :query_doc_pair
belongs_to :user, optional: true

# rubocop:disable Rails/UniqueValidationWithoutIndex
validates :user_id, :uniqueness => { :scope => :query_doc_pair_id }
# rubocop:enable Rails/UniqueValidationWithoutIndex

validates :rating,
presence: true, unless: :unrateable

Expand Down
6 changes: 3 additions & 3 deletions app/models/search_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SearchEndpoint < ApplicationRecord

# Scopes
scope :not_archived, -> { where('`search_endpoints`.`archived` = false') }

# rubocop:disable Layout/LineLength
scope :for_user_via_teams, ->(user) {
joins('
Expand Down Expand Up @@ -59,7 +59,7 @@ class SearchEndpoint < ApplicationRecord
ids = for_user_via_teams(user).distinct.pluck(:id) + for_user_directly_owned(user).distinct.pluck(:id)
where(id: ids.uniq)
}

after_initialize do |se|
se.archived = false if se.archived.nil?
end
Expand All @@ -72,7 +72,7 @@ class SearchEndpoint < ApplicationRecord
def fullname
(name.presence || middle_truncate("#{search_engine.capitalize} #{endpoint_url}"))
end

def mark_archived
self.archived = true
end
Expand Down
3 changes: 2 additions & 1 deletion app/views/api/v1/teams/_team.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ unless for_sharing
end

json.search_endpoints do
json.array! team.search_endpoints.not_archived, partial: 'api/v1/search_endpoints/search_endpoint', as: :search_endpoint
json.array! team.search_endpoints.not_archived, partial: 'api/v1/search_endpoints/search_endpoint',
as: :search_endpoint
end
json.owner do
json.id team.owner.id
Expand Down
4 changes: 2 additions & 2 deletions app/views/search_endpoints/_search_endpoint.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

json.extract! search_endpoint, :id, :name, :endpoint_url, :search_engine, :custom_headers, :api_method, :archived, :created_at,
:updated_at
json.extract! search_endpoint, :id, :name, :endpoint_url, :search_engine, :custom_headers, :api_method, :archived,
:created_at, :updated_at
json.url search_endpoint_url(search_endpoint, format: :json)