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

[hibernate-search] Implement indexing and search #6283

Open
wants to merge 28 commits into
base: hibernate-search
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
421fb5d
Implement search
matthias-ronge Oct 28, 2024
9de7742
Add search fields to Process and Task beans
matthias-ronge Oct 29, 2024
31f8343
Fix indexing issues
matthias-ronge Oct 29, 2024
a8db792
Get search to work, use IndexingService, some clean-up
matthias-ronge Oct 29, 2024
18e3462
Fix checkstyle (Kitodo - Data Management)
matthias-ronge Oct 29, 2024
dcfa749
Fix checkstyle (Kitodo - Core)
matthias-ronge Oct 30, 2024
f854533
Re-enable the global search slot
matthias-ronge Oct 30, 2024
e5b9bf5
Fix some more things
matthias-ronge Oct 30, 2024
be9829a
Reduce log output
matthias-ronge Oct 30, 2024
9115abd
Do not crash tests with orphaned task objects
matthias-ronge Oct 30, 2024
d364da6
Betterr logging
matthias-ronge Oct 31, 2024
0f02806
Fix tasks indexing
matthias-ronge Oct 31, 2024
739b109
Improve log files
matthias-ronge Oct 31, 2024
38abea6
Fix overgeneration of translated keys
matthias-ronge Oct 31, 2024
02c8f28
Remove what isn't absolutely necessary
matthias-ronge Nov 14, 2024
a3b6016
Prevent loading tasks in wrong Hibernate session for indexing
matthias-ronge Nov 14, 2024
14ee114
Remove what isn't absolutely necessary
matthias-ronge Nov 18, 2024
663b222
Make indexing much faster avoiding to reload related objects each time
matthias-ronge Nov 26, 2024
8a2087d
Adapt to the guidelines of the community board
matthias-ronge Nov 26, 2024
1176bdf
Fix checkstyle
matthias-ronge Nov 26, 2024
cf151ab
Adds javadoc
matthias-ronge Nov 26, 2024
eb8f044
Fix processes list
matthias-ronge Nov 26, 2024
01c169e
Do not sort query for any object
matthias-ronge Nov 26, 2024
b64a28a
Simplify creation of debug output
matthias-ronge Dec 4, 2024
acb891c
Remove unused import
matthias-ronge Dec 4, 2024
2f5979e
Add comment to number of elements logged
matthias-ronge Dec 4, 2024
e76f6e0
Undo accidental commit of messages file
matthias-ronge Dec 5, 2024
b6fb9ba
Fix NonUniqueObjectException
matthias-ronge Dec 10, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;

/**
* This bean contains properties common for Template and Process.
*/
@MappedSuperclass
public abstract class BaseTemplateBean extends BaseBean {

@GenericField
@Column(name = "title")
protected String title;

@Column(name = "creationDate")
protected Date creationDate;

@GenericField
@Column(name = "sortHelperStatus")
private String sortHelperStatus;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
import org.kitodo.data.database.enums.BatchType;
import org.kitodo.data.database.persistence.BatchDAO;

Expand All @@ -41,15 +38,13 @@
* multi-journal binding unit.
*/
@Entity
@Indexed(index = "kitodo-batch")
@Table(name = "batch")
public class Batch extends BaseBean {

/**
* The batch title. Using titles for batches is optional, the field may be
* {@code null}. If so, the ID will be shown to the user instead.
*/
@GenericField
@Column(name = "title")
private String title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.kitodo.data.database.persistence.ClientDAO;

@Entity
@Table(name = "client")
public class Client extends BaseBean {

@GenericField
@Column(name = "name")
private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.kitodo.data.database.enums.CommentType;

@Entity
Expand All @@ -32,15 +32,13 @@ public class Comment extends BaseBean {
* The field message holds the comment message.
*/
@Column(name = "message", columnDefinition = "longtext")
@GenericField
private String message;

/**
* The field type holds the comment type.
*/
@Column(name = "type")
@Enumerated(EnumType.STRING)
@GenericField
private CommentType type;

/**
Expand All @@ -65,29 +63,29 @@ public class Comment extends BaseBean {
/**
* This field contains information about user, which create the comment.
*/
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "FK_comment_user_id"))
private User author;

/**
* This field contains information about the currentTask, when the comment is created.
*/
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "currentTask_id", foreignKey = @ForeignKey(name = "FK_comment_currentTask_id"))
private Task currentTask;

/**
* This field contains information about the correctionTask, where the user can correct the error.
*/
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "correctionTask_id", foreignKey = @ForeignKey(name = "FK_comment_correctionTask_id"))
private Task correctionTask;


/**
* The field process holds the process of the comment.
*/
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "process_id", foreignKey = @ForeignKey(name = "FK_comment_process_id"))
private Process process;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,26 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;

@Entity
@Indexed(index = "kitodo-docket")
@Table(name = "docket")
public class Docket extends BaseBean {

@GenericField
@Column(name = "title")
private String title;

@GenericField
@Column(name = "file")
private String file;

@GenericField
@Column(name = "active")
private Boolean active = true;

@ManyToOne
@IndexedEmbedded(includePaths = {"id", "name"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "client_id", foreignKey = @ForeignKey(name = "FK_docket_client_id"))
private Client client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,20 @@
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;

/**
* Filter bean.
*/
@Entity
@Indexed(index = "kitodo-filter")
@Table(name = "filter")
public class Filter extends BaseBean {

@GenericField
@Column(name = "value", columnDefinition = "longtext")
private String value;

@GenericField
@Column(name = "creationDate")
private Date creationDate;

@ManyToOne
@IndexedEmbedded(includePaths = {"id"})
@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "FK_filter_user_id"))
private User user;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.kitodo.api.imagemanagement.ImageManagementInterface;
import org.kitodo.config.ConfigMain;
import org.kitodo.data.database.enums.LinkingMode;
Expand Down Expand Up @@ -105,7 +104,6 @@ public class Folder extends BaseBean {
* contents of this folder will be linked.
*/
@Column(name = "fileGroup")
@GenericField
private String fileGroup;

/**
Expand All @@ -132,14 +130,12 @@ public class Folder extends BaseBean {
* @see org.kitodo.config.xml.fileformats.FileFormatsConfig
*/
@Column(name = "mimeType")
@GenericField
private String mimeType = "image/jpeg";

/**
* The path to the folder in the process directory of each processes.
*/
@Column(name = "path")
@GenericField
private String path = "";

/**
Expand All @@ -155,7 +151,6 @@ public class Folder extends BaseBean {
* replaced before concatenation.
*/
@Column(name = "urlStructure")
@GenericField
private String urlStructure;

/**
Expand Down
Loading
Loading