Lines Matching refs:clause
1406 * Creates a token set from a query clause.
1409 * @param {Object} clause - A single clause from lunr.Query.
1410 * @param {string} clause.term - The query clause term.
1411 * @param {number} [clause.editDistance] - The optional edit distance for the term.
1414 lunr.TokenSet.fromClause = function (clause) {
1415 if ('editDistance' in clause) {
1416 return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)
1418 return lunr.TokenSet.fromString(clause.term)
1961 // for each query clause
1989 * the case for terms with wildcards, we need to pass the clause
1995 var clause = query.clauses[i],
1999 if (clause.usePipeline) {
2000 terms = this.pipeline.runString(clause.term, {
2001 fields: clause.fields
2004 terms = [clause.term]
2012 * clause object, e.g. the same boost and or edit distance. The
2013 * simplest way to do this is to re-use the clause object but mutate
2016 clause.term = term
2019 * From the term in the clause we create a token set which will then
2023 var termTokenSet = lunr.TokenSet.fromClause(clause),
2032 if (expandedTerms.length === 0 && clause.presence === lunr.Query.presence.REQUIRED) {
2033 for (var k = 0; k < clause.fields.length; k++) {
2034 var field = clause.fields[k]
2050 for (var k = 0; k < clause.fields.length; k++) {
2059 var field = clause.fields[k],
2067 * documents are added to the set of required matches for this clause.
2070 if (clause.presence == lunr.Query.presence.REQUIRED) {
2083 if (clause.presence == lunr.Query.presence.PROHIBITED) {
2105 queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b })
2143 * the clause terms presence is required in _any_ of the fields not _all_ of the
2146 if (clause.presence === lunr.Query.presence.REQUIRED) {
2147 for (var k = 0; k < clause.fields.length; k++) {
2148 var field = clause.fields[k]
2804 * Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.
2817 * @see lunr.Query#clause
2838 * @see lunr.Query#clause
2863 * A single clause in a {@link lunr.Query} contains a term and details on how to
2867 * @property {string[]} fields - The fields in an index this clause should be matched against.
2868 * @property {number} [boost=1] - Any boost that should be applied when matching this clause.
2878 * Unless the clause contains the fields to be matched all fields will be matched. In addition
2879 * a default boost of 1 is applied to the clause.
2881 * @param {lunr.Query~Clause} clause - The clause to add to this query.
2885 lunr.Query.prototype.clause = function (clause) {
2886 if (!('fields' in clause)) {
2887 clause.fields = this.allFields
2890 if (!('boost' in clause)) {
2891 clause.boost = 1
2894 if (!('usePipeline' in clause)) {
2895 clause.usePipeline = true
2898 if (!('wildcard' in clause)) {
2899 clause.wildcard = lunr.Query.wildcard.NONE
2902 if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {
2903 clause.term = "*" + clause.term
2906 if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {
2907 clause.term = "" + clause.term + "*"
2910 if (!('presence' in clause)) {
2911 clause.presence = lunr.Query.presence.OPTIONAL
2914 this.clauses.push(clause)
2920 * A negated query is one in which every clause has a presence of
2947 * @param {object} [options] - Any additional properties to add to the query clause.
2949 * @see lunr.Query#clause
2968 var clause = options || {}
2969 clause.term = term.toString()
2971 this.clause(clause)
3224 this.query.clause(completedClause)