unobtanium 3.0.0

Opinioated Web search engine library with crawler and viewer companion.
Documentation
use crate::database::SummarySchema;
use crate::database::fields::*;

/// This enumerates all tables that have an `entity_generation_id` column
/// and can be joined to each otherr using that column without going through
/// a central point.
#[derive(Clone,Debug,PartialEq,Eq)]
pub enum EntityComponentTable {
	EntityGeneration,
	FileSummary,
	DocumentDescription,
	CrawlSummary,

	/// The HttpSummary doesn't belong in here as it is cpupled with the CrawlSummary.
	/// It should be removed and handled similar to fields coupled to the TextPile.
	HttpSummary,
	
	/// One entity can have multiple link summaries.
	/// Keep that in mind when joining.
	LinkSummary,

	/// Rge duplicate summry table from the point of the duplicate.
	/// There may be more than one of these.
	DuplicateSummarySubject,

	/// The duplicate summary table from the point of the "original".
	/// There may be more than one of these.
	DuplicateSummaryDuplicteOf,
}

impl EntityComponentTable {

	pub fn entity_generation_id_field(&self) -> SummarySchema {
		match self {
			Self::EntityGeneration =>
				EntityGenerationField::EntityGenerationId.into(),
			Self::FileSummary =>
				FileSummaryField::EntityGenerationId.into(),
			Self::DocumentDescription =>
				DocumentDescriptionField::EntityGenerationId.into(),
			Self::CrawlSummary =>
				CrawlSummaryField::EntityGenerationId.into(),
			// Http Summaries are coupled to crawl summaries
			Self::HttpSummary =>
				CrawlSummaryField::EntityGenerationId.into(),
			Self::LinkSummary =>
				LinkSummaryField::EntityGenerationId.into(),
			Self::DuplicateSummarySubject =>
				DuplicateSummaryField::SubjectEntityGenerationId.into(),
			Self::DuplicateSummaryDuplicteOf =>
				DuplicateSummaryField::DuplicateOfEntityGenerationId.into(),
		}
	}
}