Skip to content

Exports ​

Show / Hide ​

Show or hide the export button

js
vuexModules.ui.actions.results.shared.exportEnabled(false);

Exported Data ​

js
// Which annotations are included in the export
vuexModules.ui.actions.results.shared.detailedAnnotationIds(['word', 'lemma', 'pos_full']);
// Which metadata fields are included in the export
vuexModules.ui.actions.results.shared.detailedMetadataIds(['title', 'author']);

Description in Export File ​

Customize the description at the top of the export file. This is useful for providing context or instructions for the exported data.

js
frontend.customize(corpus => {
	/** @param {BLSearchSummary} blSummary */
	corpus.results.csvDescription = function(blSummary, fieldDisplayNameFunc: (name, baseFieldName) => string) {
		return `Exported from ${corpus._corpus.displayName} on ${new Date().toLocaleDateString()}.\n\n` +
			`This export includes the following fields:\n` +
			`- ${fieldDisplayNameFunc('title', 'title')}\n` +
			`- ${fieldDisplayNameFunc('author', 'author')}\n` +
			`- ${fieldDisplayNameFunc('date', 'date')}\n\n` +
			`For more information, visit our documentation.`;
	}
})
ts

export type BLSearchSummarySampleSettings = {} | {
	samplePercentage: number;
	sampleSeed: number;
} | {
	sampleSeed: number;
	sampleSize: number;
};

/** Match info definition in summary */
export type BLSummaryMatchInfo = {
	type: 'span'|'tag'|'relation'|'list';
	fieldName?: string;     // field this capture is in (if not default field)
	targetField?: string;   // field the relation target is in (if not default field)
};

export type BLSearchSummary = {
	actualWindowSize: number;
	countTime?: number;
	/** These fields have a special meaning in the BLDocResult.docInfo */
	docFields: BLDocFields;
	requestedWindowSize: number;
	searchParam: BLSearchParameters;
	searchTime: number;
	windowFirstResult: number;
	windowHasNext: boolean;
	windowHasPrevious: boolean;

	/** Only for queries with a pattern. */
	pattern?: {
		/** The serialization of the query object BlackLab actually executed. */
		bcql: string;
		/** The main annotatedField that was searched. This is the full name of the field e.g. "contents__en" */
		fieldName: string;
		/** Any other annotatedFields involved in the search (in case of parallel corpora). These are the full names e.g. ["contents__en"] */
		otherFields?: string[];
		/** Json representation of the query. Not present when requesting results as xml output. */
		json?: any;
		/* MatchInfos only available when hits are returned (i.e. not a docs request, not grouped) */
		matchInfos?: {
			[key: string]: BLSummaryMatchInfo;
		}
	}
} & BLSearchSummarySampleSettings;

export interface BLSearchSummaryTotalsDocs {
	/** Total documents across all counted (not retrieved) hits, -1 if some error occured */
	numberOfDocs: number;
	/** Total documents across all retrieved hits */
	numberOfDocsRetrieved: number;
	/** Is any hit counting ongoing, generally true unless blacklab finished counting all results or results exceed the count limit (stoppedCountingHits = true) */
	stillCounting: boolean;
	/** When a pattern was used to search docs */
	numberOfHits?: number;
	/** Only available when request was sent with includetokencount: true, and when no grouping took place. */
	tokensInMatchingDocuments?: number;
}

export interface BLSearchSummaryTotalsHits extends BLSearchSummaryTotalsDocs {
	/** Total number of counted hits (so far), -1 if some error occured */
	numberOfHits: number;
	/** Total number of retrieved hits (so far) */
	numberOfHitsRetrieved: number;
	/** Did the query hit the default count limit (defaultMaxHitsToCount) */
	stoppedCountingHits: boolean;
	/** Did the query hit the default retrieval limit (defaultMaxHitsToRetrieve) */
	stoppedRetrievingHits: boolean;
	subcorpusSize?: {
		documents: number;
		tokens: number;
		annotatedFields?: {
			fieldName: string;
			documents: number;
			tokens: number;
		}[];
	};
}

export interface BLSearchSummaryGroupInfo {
	largestGroupSize: number;
	numberOfGroups: number;
	/** Contains the size of the entire searched subcorpus (e.g. number of docs and tokens found by the same query without a cql pattern). */
	subcorpusSize: {
		/** NOTE: may be 0 in rare cases, when specifying a search for the empty value for all metadata fields */
		documents: number;
		/** NOTE: may be 0 in rare cases, when specifying a search for the empty value for all metadata fields */
		tokens: number;
	};
}

Apache license 2.0