mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +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};
|
use crate::{DocumentId, Index, Result};
|
||||||
|
|
||||||
pub enum DocumentChange<'doc> {
|
pub enum DocumentChange<'doc> {
|
||||||
Deletion(Deletion),
|
Deletion(Deletion<'doc>),
|
||||||
Update(Update<'doc>),
|
Update(Update<'doc>),
|
||||||
Insertion(Insertion<'doc>),
|
Insertion(Insertion<'doc>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Deletion {
|
pub struct Deletion<'doc> {
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
external_document_id: String,
|
external_document_id: &'doc str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Update<'doc> {
|
pub struct Update<'doc> {
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
external_document_id: String,
|
external_document_id: &'doc str,
|
||||||
new: DocumentFromVersions<'doc>,
|
new: DocumentFromVersions<'doc>,
|
||||||
has_deletion: bool,
|
has_deletion: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Insertion<'doc> {
|
pub struct Insertion<'doc> {
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
external_document_id: String,
|
external_document_id: &'doc str,
|
||||||
new: DocumentFromVersions<'doc>,
|
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 {
|
match self {
|
||||||
DocumentChange::Deletion(deletion) => deletion.external_document_id(),
|
DocumentChange::Deletion(deletion) => deletion.external_document_id(),
|
||||||
DocumentChange::Update(update) => update.external_document_id(),
|
DocumentChange::Update(update) => update.external_document_id(),
|
||||||
@ -47,8 +47,8 @@ impl<'doc> DocumentChange<'doc> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deletion {
|
impl<'doc> Deletion<'doc> {
|
||||||
pub fn create(docid: DocumentId, external_document_id: String) -> Self {
|
pub fn create(docid: DocumentId, external_document_id: &'doc str) -> Self {
|
||||||
Self { docid, external_document_id }
|
Self { docid, external_document_id }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ impl Deletion {
|
|||||||
self.docid
|
self.docid
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn external_document_id(&self) -> &str {
|
pub fn external_document_id(&self) -> &'doc str {
|
||||||
&self.external_document_id
|
self.external_document_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn current<'a, Mapper: FieldIdMapper>(
|
pub fn current<'a, Mapper: FieldIdMapper>(
|
||||||
@ -75,7 +75,7 @@ impl Deletion {
|
|||||||
impl<'doc> Insertion<'doc> {
|
impl<'doc> Insertion<'doc> {
|
||||||
pub fn create(
|
pub fn create(
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
external_document_id: String,
|
external_document_id: &'doc str,
|
||||||
new: DocumentFromVersions<'doc>,
|
new: DocumentFromVersions<'doc>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Insertion { docid, external_document_id, new }
|
Insertion { docid, external_document_id, new }
|
||||||
@ -85,8 +85,8 @@ impl<'doc> Insertion<'doc> {
|
|||||||
self.docid
|
self.docid
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn external_document_id(&self) -> &str {
|
pub fn external_document_id(&self) -> &'doc str {
|
||||||
&self.external_document_id
|
self.external_document_id
|
||||||
}
|
}
|
||||||
pub fn new(&self) -> DocumentFromVersions<'doc> {
|
pub fn new(&self) -> DocumentFromVersions<'doc> {
|
||||||
self.new
|
self.new
|
||||||
@ -96,7 +96,7 @@ impl<'doc> Insertion<'doc> {
|
|||||||
impl<'doc> Update<'doc> {
|
impl<'doc> Update<'doc> {
|
||||||
pub fn create(
|
pub fn create(
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
external_document_id: String,
|
external_document_id: &'doc str,
|
||||||
new: DocumentFromVersions<'doc>,
|
new: DocumentFromVersions<'doc>,
|
||||||
has_deletion: bool,
|
has_deletion: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -107,8 +107,8 @@ impl<'doc> Update<'doc> {
|
|||||||
self.docid
|
self.docid
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn external_document_id(&self) -> &str {
|
pub fn external_document_id(&self) -> &'doc str {
|
||||||
&self.external_document_id
|
self.external_document_id
|
||||||
}
|
}
|
||||||
pub fn current<'a, Mapper: FieldIdMapper>(
|
pub fn current<'a, Mapper: FieldIdMapper>(
|
||||||
&self,
|
&self,
|
||||||
|
Loading…
Reference in New Issue
Block a user