Lines Matching refs:field

24  *   this.field('title')
25 * this.field('body')
162 throw "malformed field ref string"
323 if (fieldName == '_index') continue // Ignore the term index, its not a field
522 * @param {number} i - The index of this token in the complete list of tokens for this document/field.
523 * @param {lunr.Token[]} tokens - All tokens for this document/field.
1843 * @param {Object} attrs.invertedIndex - An index of term/field to document reference.
1882 * hello in the title field will match this query. Using a field not present in the index will lead
1905 * @example <caption>term scoped to a field</caption>
1976 * To support field level boosts a query vector is created per
1977 * field. An empty vector is eagerly created to support negated
2028 * impossible for the search to return any matches. We set all the field
2034 var field = clause.fields[k]
2035 requiredMatches[field] = lunr.Set.empty
2052 * For each field that this query term is scoped by (by default
2054 * that have this term in that field.
2059 var field = clause.fields[k],
2060 fieldPosting = posting[field],
2062 termField = expandedTerm + "/" + field,
2073 if (requiredMatches[field] === undefined) {
2074 requiredMatches[field] = lunr.Set.complete
2080 * documents are added to the set of prohibited matches for this field,
2084 if (prohibitedMatches[field] === undefined) {
2085 prohibitedMatches[field] = lunr.Set.empty
2088 prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet)
2093 * to the next field
2099 * The query field vector is populated using the termIndex found for
2105 queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b })
2108 * If we've already seen this term, field combo then we've already collected
2117 * All metadata for this term/field/document triple
2123 matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),
2128 matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)
2130 fieldMatch.add(expandedTerm, field, metadata)
2141 * If the presence was required we need to update the requiredMatches field sets.
2148 var field = clause.fields[k]
2149 requiredMatches[field] = requiredMatches[field].intersect(clauseMatches)
2155 * Need to combine the field scoped required and prohibited
2163 var field = this.fields[i]
2165 if (requiredMatches[field]) {
2166 allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field])
2169 if (prohibitedMatches[field]) {
2170 allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field])
2204 * Scores are calculated by field, using the query vectors created
2335 * @property {string} _ref - Internal reference to the document reference field.
2344 * @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.
2367 * Sets the document field used as the document reference. Every document must have this field.
2368 * The type of this field in the document should be a string, if it is not a string it will be
2376 * @param {string} ref - The name of the reference field in the document.
2383 * A function that is used to extract a field from a document.
2385 * Lunr expects a field to be at the top level of a document, if however the field
2387 * the right field for indexing.
2391 * @returns {?(string|object|object[])} obj - The object that will be indexed for this field.
2392 * @example <caption>Extracting a nested field</caption>
2393 * function (doc) { return doc.nested.field }
2397 * Adds a field to the list of document fields that will be indexed. Every document being
2398 * indexed should have this field. Null values for this field in indexed documents will
2404 * Fields can be boosted at build time. This allows terms within that field to have more
2405 * importance when ranking search results. Use a field boost to specify that matches within
2406 * one field are more important than other fields.
2408 * @param {string} fieldName - The name of a field to index in all documents.
2409 * @param {object} attributes - Optional attributes associated with this field.
2410 * @param {number} [attributes.boost=1] - Boost applied to all terms within this field.
2411 * @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.
2414 lunr.Builder.prototype.field = function (fieldName, attributes) {
2423 * A parameter to tune the amount of field length normalisation that is applied when
2425 * and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b
2457 * The document must have a field name as specified by the ref (by default this is 'id') and
2478 field = extractor ? extractor(doc) : doc[fieldName],
2479 tokens = this.tokenizer(field, {
2489 // store the length of this field for this document
2492 // calculate term frequencies for this field
2552 field = fieldRef.fieldName
2554 documentsWithField[field] || (documentsWithField[field] = 0)
2555 documentsWithField[field] += 1
2557 accumulator[field] || (accumulator[field] = 0)
2558 accumulator[field] += this.fieldLengths[fieldRef]
2687 * @param {string} field - The field in which the term was found
2688 * @param {object} metadata - The metadata recorded about this term in this field
2692 lunr.MatchData = function (term, field, metadata) {
2710 this.metadata[term][field] = clonedMetadata
2735 var field = fields[j],
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.
2760 * @param {string} field - The field in which the term was found
2761 * @param {object} metadata - The metadata recorded about this term in this field
2763 lunr.MatchData.prototype.add = function (term, field, metadata) {
2766 this.metadata[term][field] = metadata
2770 if (!(field in this.metadata[term])) {
2771 this.metadata[term][field] = 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]
3243 var errorMessage = "expected either a field or a term, found " + lexeme.type
3275 var errorMessage = "expecting term or field, found nothing"
3285 var errorMessage = "expecting term or field, found '" + nextLexeme.type + "'"
3299 errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields