Skip to content

Commit

Permalink
MODE-1028 Corrected how PATH property values are indexed (they were i…
Browse files Browse the repository at this point in the history
…mproperly indexed as REFERENCE types).

git-svn-id: https://svn.jboss.org/repos/modeshape/trunk@2628 76366958-4244-0410-ad5e-bbfabb93f86b
  • Loading branch information
Randall Hauch committed Dec 22, 2010
1 parent 2cf70d9 commit d155379
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Expand Up @@ -414,6 +414,24 @@ public Builder binaryField( Name name,
return this;
}

/**
* Define a path-based field in the indexes. This method will overwrite any existing definition in this builder.
*
* @param name the name of the field
* @param store the storage setting, or null if the field should be {@link Store#YES stored}
* @param index the index setting, or null if the field should be indexed but {@link Index#NOT_ANALYZED not analyzed}
* @return this builder for convenience and method chaining; never null
*/
public Builder pathField( Name name,
Field.Store store,
Field.Index index ) {
if (store == null) store = Field.Store.YES;
if (index == null) index = Field.Index.NOT_ANALYZED;
Rule rule = new TypedRule(FieldType.STRING, store, index, false, false);
rulesByName.put(name, rule);
return this;
}

/**
* Define a reference-based field in the indexes. This method will overwrite any existing definition in this builder.
*
Expand Down
Expand Up @@ -326,8 +326,7 @@ protected final void addIndexRule( IndexRules.Builder builder,
store = Store.NO;
builder.referenceField(defn.getInternalName(), store, index);
} else if (typeSystem.getPathFactory().getTypeName().equals(type)) {
store = Store.NO;
builder.weakReferenceField(defn.getInternalName(), store, index, defn.isFullTextSearchable());
builder.pathField(defn.getInternalName(), store, index);
} else {
// Everything else gets stored as a string ...
builder.stringField(defn.getInternalName(), store, index, canBeReference, defn.isFullTextSearchable());
Expand Down

0 comments on commit d155379

Please sign in to comment.