Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
c8f459db
Commit
c8f459db
authored
2 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Drop Solr collections before re-creating them in manage.py reindex
parent
4d92ad94
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1850
Drop Solr collections before re-creating them in manage.py reindex
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/documents/indexer.py
+5
-2
5 additions, 2 deletions
arkindex/documents/indexer.py
arkindex/documents/management/commands/reindex.py
+3
-3
3 additions, 3 deletions
arkindex/documents/management/commands/reindex.py
with
8 additions
and
5 deletions
arkindex/documents/indexer.py
+
5
−
2
View file @
c8f459db
...
...
@@ -186,8 +186,11 @@ class Indexer(object):
"""
Drop an existing collection
"""
solr
.
delete_doc_by_query
(
self
.
collection_name
,
'
*:*
'
,
**
self
.
solr_options
)
logger
.
info
(
f
'
Dropped index for
{
self
.
collection_name
}
'
)
if
solr
.
collections
.
exists
(
self
.
collection_name
):
solr
.
delete_doc_by_query
(
self
.
collection_name
,
'
*:*
'
,
**
self
.
solr_options
)
logger
.
info
(
f
'
Dropped index for
{
self
.
collection_name
}
'
)
else
:
logger
.
info
(
f
'
Skipping drop for
{
self
.
collection_name
}
: collection does not exist
'
)
def
get_elements
(
self
):
# First make the query that returns all indexable elements.
...
...
This diff is collapsed.
Click to expand it.
arkindex/documents/management/commands/reindex.py
+
3
−
3
View file @
c8f459db
...
...
@@ -48,9 +48,9 @@ class Command(BaseCommand):
for
corpus
in
corpora
:
self
.
stdout
.
write
(
f
"
Indexing
{
corpus
.
name
}
"
)
indexer
=
Indexer
(
corpus
.
id
)
indexer
.
setup
()
if
options
.
get
(
'
setup
'
):
return
if
options
.
get
(
'
drop
'
):
indexer
.
drop_index
()
indexer
.
setup
()
if
options
.
get
(
'
setup
'
):
continue
indexer
.
index
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment