Lines Matching refs:metadata
338 * @param {object} [metadata={}] - Metadata associated with this token.
340 lunr.Token = function (str, metadata) {
342 this.metadata = metadata || {}
360 * @param {Object} metadata - All metadata associated with this token.
367 * token.update(function (str, metadata) {
375 this.str = fn(this.str, this.metadata)
388 return new lunr.Token (fn(this.str, this.metadata), this.metadata)
404 * Optional metadata can be passed to the tokenizer, this metadata will be cloned and
405 * added as metadata to every token that is created from the object to be tokenized.
409 * @param {?object} metadata - Optional metadata to associate with every token
413 lunr.tokenizer = function (obj, metadata) {
422 lunr.utils.clone(metadata)
438 var tokenMetadata = lunr.utils.clone(metadata) || {}
508 * string as well as all known metadata. A pipeline function can mutate the token string
509 * or mutate (or add) metadata for a given token.
699 * @param {?object} metadata - Optional metadata to associate with the token
703 lunr.Pipeline.prototype.runString = function (str, metadata) {
704 var token = new lunr.Token (str, metadata)
1862 * @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.
1964 // * find matching documents and metadata
2092 * similarity scoring and no metadata should be extracted so we continue
2109 * the matching documents and metadata, no need to go through all that again
2117 * All metadata for this term/field/document triple
2124 metadata = fieldPosting[matchingDocumentRef],
2128 matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)
2130 fieldMatch.add(expandedTerm, field, metadata)
2347 * @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.
2521 // store all whitelisted metadata about this token in the
2525 metadata = term.metadata[metadataKey]
2531 this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata)
2681 * Contains and collects metadata about a matching document.
2688 * @param {object} metadata - The metadata recorded about this term in this field
2689 * @property {object} metadata - A cloned collection of metadata associated with this document.
2692 lunr.MatchData = function (term, field, metadata) {
2694 metadataKeys = Object.keys(metadata || {})
2696 // Cloning the metadata to prevent the original
2703 clonedMetadata[key] = metadata[key].slice()
2706 this.metadata = Object.create(null)
2709 this.metadata[term] = Object.create(null)
2710 this.metadata[term][field] = clonedMetadata
2717 * method combines metadata from another instance of lunr.MatchData with this
2718 * objects metadata.
2724 var terms = Object.keys(otherMatchData.metadata)
2728 fields = Object.keys(otherMatchData.metadata[term])
2730 if (this.metadata[term] == undefined) {
2731 this.metadata[term] = Object.create(null)
2736 keys = Object.keys(otherMatchData.metadata[term][field])
2738 if (this.metadata[term][field] == undefined) {
2739 this.metadata[term][field] = Object.create(null)
2745 if (this.metadata[term][field][key] == undefined) {
2746 this.metadata[term][field][key] = otherMatchData.metadata[term][field][key]
2748 this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key])
2757 * Add metadata for a term/field pair to this instance of match data.
2761 * @param {object} metadata - The metadata recorded about this term in this field
2763 lunr.MatchData.prototype.add = function (term, field, metadata) {
2764 if (!(term in this.metadata)) {
2765 this.metadata[term] = Object.create(null)
2766 this.metadata[term][field] = metadata
2770 if (!(field in this.metadata[term])) {
2771 this.metadata[term][field] = metadata
2775 var metadataKeys = Object.keys(metadata)
2780 if (key in this.metadata[term][field]) {
2781 this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key])
2783 this.metadata[term][field][key] = metadata[key]