mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 10:07:40 +08:00
External docids to &'bump str
This commit is contained in:
parent
7df20d8282
commit
28d92c521a
@ -6,26 +6,26 @@ use crate::documents::FieldIdMapper;
|
||||
use crate::{DocumentId, Index, Result};
|
||||
|
||||
pub enum DocumentChange<'doc> {
|
||||
Deletion(Deletion),
|
||||
Deletion(Deletion<'doc>),
|
||||
Update(Update<'doc>),
|
||||
Insertion(Insertion<'doc>),
|
||||
}
|
||||
|
||||
pub struct Deletion {
|
||||
pub struct Deletion<'doc> {
|
||||
docid: DocumentId,
|
||||
external_document_id: String,
|
||||
external_document_id: &'doc str,
|
||||
}
|
||||
|
||||
pub struct Update<'doc> {
|
||||
docid: DocumentId,
|
||||
external_document_id: String,
|
||||
external_document_id: &'doc str,
|
||||
new: DocumentFromVersions<'doc>,
|
||||
has_deletion: bool,
|
||||
}
|
||||
|
||||
pub struct Insertion<'doc> {
|
||||
docid: DocumentId,
|
||||
external_document_id: String,
|
||||
external_document_id: &'doc str,
|
||||
new: DocumentFromVersions<'doc>,
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ impl<'doc> DocumentChange<'doc> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn external_docid(&self) -> &str {
|
||||
pub fn external_docid(&self) -> &'doc str {
|
||||
match self {
|
||||
DocumentChange::Deletion(deletion) => deletion.external_document_id(),
|
||||
DocumentChange::Update(update) => update.external_document_id(),
|
||||
@ -47,8 +47,8 @@ impl<'doc> DocumentChange<'doc> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deletion {
|
||||
pub fn create(docid: DocumentId, external_document_id: String) -> Self {
|
||||
impl<'doc> Deletion<'doc> {
|
||||
pub fn create(docid: DocumentId, external_document_id: &'doc str) -> Self {
|
||||
Self { docid, external_document_id }
|
||||
}
|
||||
|
||||
@ -56,8 +56,8 @@ impl Deletion {
|
||||
self.docid
|
||||
}
|
||||
|
||||
pub fn external_document_id(&self) -> &str {
|
||||
&self.external_document_id
|
||||
pub fn external_document_id(&self) -> &'doc str {
|
||||
self.external_document_id
|
||||
}
|
||||
|
||||
pub fn current<'a, Mapper: FieldIdMapper>(
|
||||
@ -75,7 +75,7 @@ impl Deletion {
|
||||
impl<'doc> Insertion<'doc> {
|
||||
pub fn create(
|
||||
docid: DocumentId,
|
||||
external_document_id: String,
|
||||
external_document_id: &'doc str,
|
||||
new: DocumentFromVersions<'doc>,
|
||||
) -> Self {
|
||||
Insertion { docid, external_document_id, new }
|
||||
@ -85,8 +85,8 @@ impl<'doc> Insertion<'doc> {
|
||||
self.docid
|
||||
}
|
||||
|
||||
pub fn external_document_id(&self) -> &str {
|
||||
&self.external_document_id
|
||||
pub fn external_document_id(&self) -> &'doc str {
|
||||
self.external_document_id
|
||||
}
|
||||
pub fn new(&self) -> DocumentFromVersions<'doc> {
|
||||
self.new
|
||||
@ -96,7 +96,7 @@ impl<'doc> Insertion<'doc> {
|
||||
impl<'doc> Update<'doc> {
|
||||
pub fn create(
|
||||
docid: DocumentId,
|
||||
external_document_id: String,
|
||||
external_document_id: &'doc str,
|
||||
new: DocumentFromVersions<'doc>,
|
||||
has_deletion: bool,
|
||||
) -> Self {
|
||||
@ -107,8 +107,8 @@ impl<'doc> Update<'doc> {
|
||||
self.docid
|
||||
}
|
||||
|
||||
pub fn external_document_id(&self) -> &str {
|
||||
&self.external_document_id
|
||||
pub fn external_document_id(&self) -> &'doc str {
|
||||
self.external_document_id
|
||||
}
|
||||
pub fn current<'a, Mapper: FieldIdMapper>(
|
||||
&self,
|
||||
|
Loading…
Reference in New Issue
Block a user