SOLR-3572: Make schema-browser show custom similarities

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1373117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Greg Bowyer 2012-08-14 21:16:17 +00:00
parent 796fb31c89
commit 8a5bab3e1d
3 changed files with 26 additions and 3 deletions

View File

@ -31,6 +31,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.index.*;
import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CharsRef;
@ -425,6 +426,7 @@ public class LukeRequestHandler extends RequestHandlerBase
field.add("className", ft.getClass().getName());
field.add("indexAnalyzer", getAnalyzerInfo(ft.getAnalyzer()));
field.add("queryAnalyzer", getAnalyzerInfo(ft.getQueryAnalyzer()));
field.add("similarity", getSimilarityInfo(ft.getSimilarity()));
types.add( ft.getTypeName(), field );
}
@ -450,6 +452,14 @@ public class LukeRequestHandler extends RequestHandlerBase
return finfo;
}
private static SimpleOrderedMap<Object> getSimilarityInfo(Similarity similarity) {
SimpleOrderedMap<Object> toReturn = new SimpleOrderedMap<Object>();
if (similarity != null) {
toReturn.add("className", similarity.getClass().getName());
toReturn.add("details", similarity.toString());
}
return toReturn;
}
private static SimpleOrderedMap<Object> getAnalyzerInfo(Analyzer analyzer) {
SimpleOrderedMap<Object> aninfo = new SimpleOrderedMap<Object>();

View File

@ -871,7 +871,7 @@ sammy.get
var pig_element = $( 'dt.position-increment-gap', options_element );
if( is_f && schema_browser_data.fields[field] && schema_browser_data.fields[field].positionIncrementGap )
{
$( 'dt.position-increment-gap', options_element )
$( 'dd.position-increment-gap', options_element )
.remove();
pig_element
@ -883,7 +883,18 @@ sammy.get
$( '.position-increment-gap', options_element )
.hide();
}
var similarity_element = $( 'dt.similarity', options_element );
if ( is_t && schema_browser_data.types[field] && schema_browser_data.types[field].similarity ) {
var similarity = schema_browser_data.types[field].similarity
$( 'dd.similarity', options_element ).remove();
similarity_element
.show()
.after(['<dd class="similarity">', similarity.details.esc(), ' (', similarity.className.esc(), ') </dd>'].join(""));
} else {
$( '.similarity', options_element ).hide();
}
var analyzer_element = $( '.analyzer', data_element );
var analyzer_data = null;
@ -1190,4 +1201,4 @@ sammy.get
trigger_params
);
}
);
);

View File

@ -35,6 +35,8 @@ limitations under the License.
<dt class="field-type">Field-Type:</dt>
<dt class="similarity">Similarity:</dt>
<dt class="properties">Properties:</dt>
<dt class="schema">Schema:</dt>