Tabnine Logo
IndexOptions.weights
Code IndexAdd Tabnine to your IDE (free)

How to use
weights
method
in
com.mongodb.client.model.IndexOptions

Best Java code snippets using com.mongodb.client.model.IndexOptions.weights (Showing top 11 results out of 315)

origin: MorphiaOrg/morphia

private void calculateWeights(final Index index, final com.mongodb.client.model.IndexOptions indexOptions) {
  Document weights = new Document();
  for (Field field : index.fields()) {
    if (field.weight() != -1) {
      if (field.type() != IndexType.TEXT) {
        throw new MappingException("Weight values only apply to text indexes: " + Arrays.toString(index.fields()));
      }
      weights.put(field.value(), field.weight());
    }
  }
  if (!weights.isEmpty()) {
    indexOptions.weights(weights);
  }
}
origin: spring-projects/spring-data-mongodb

ops = ops.weights((org.bson.Document) indexOptions.get("weights"));
origin: org.springframework.data/spring-data-mongodb

ops = ops.weights((org.bson.Document) indexOptions.get("weights"));
origin: org.mongodb.morphia/morphia

private void calculateWeights(final Index index, final com.mongodb.client.model.IndexOptions indexOptions) {
  Document weights = new Document();
  for (Field field : index.fields()) {
    if (field.weight() != -1) {
      if (field.type() != IndexType.TEXT) {
        throw new MappingException("Weight values only apply to text indexes: " + Arrays.toString(index.fields()));
      }
      weights.put(field.value(), field.weight());
    }
  }
  if (!weights.isEmpty()) {
    indexOptions.weights(weights);
  }
}
origin: johnlpage/POCDriver

weights.put("lorem", 15);
weights.put("_fulltext.text", 5);
options.weights(weights);
Document index = new Document();
index.put("$**", "text");
origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb

  break;
case "weights":
  indexOptions.weights((Bson) value);
  break;
case "languageOverride":
origin: hibernate/hibernate-ogm

indexOptions.weights( (Bson) options.get( "weights" ) );
origin: org.hibernate.ogm/hibernate-ogm-mongodb

indexOptions.weights( (Bson) options.get( "weights" ) );
origin: lordofthejars/nosql-unit

mongoDbIndexOptions.weights(indexOptions.get("weights", Bson.class));
origin: com.github.dadrus.jpa-unit/jpa-unit-mongodb

applyIfTrue(options.containsKey("unique"), () -> indexOptions.unique(options.getBoolean("unique")));
applyIfTrue(options.containsKey("version"), () -> indexOptions.version(options.getInteger("version")));
applyIfTrue(options.containsKey("weights"), () -> indexOptions.weights(options.get("weights", Bson.class)));
origin: SoftInstigate/restheart

ret.weights(options.get("weights")
    .asDocument());
com.mongodb.client.modelIndexOptionsweights

Javadoc

Sets the weighting object for use with a text index.

An document that represents field and weight pairs. The weight is an integer ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields in terms of the score.

Popular methods of IndexOptions

  • <init>
  • unique
    Should the index should be unique.
  • name
    Sets the name of the index.
  • background
    Should the index should be created in the background
  • expireAfter
    Sets the time to live for documents in the collection
  • sparse
    Should the index only references documents with the specified field
  • partialFilterExpression
    Sets the filter expression for the documents to be included in the index
  • defaultLanguage
    Sets the language for the text index.The language that determines the list of stop words and the rul
  • languageOverride
    Sets the name of the field that contains the language string.For text indexes, the name of the field
  • bits
    Sets the number of precision of the stored geohash value of the location data in 2d indexes.
  • getName
    Gets the name of the index.
  • isUnique
    Gets if the index should be unique.
  • getName,
  • isUnique,
  • max,
  • min,
  • sphereVersion,
  • bucketSize,
  • collation,
  • getDefaultLanguage,
  • getLanguageOverride

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Kernel (java.awt.image)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now