Methods Summary |
---|
private static ContentStrategy | chooseStrategy(java.lang.String contentType, org.apache.lucene.gdata.search.config.IndexSchemaField config)
ContentType type = null;
try {
type = ContentType.valueOf(contentType==null?"TEXT":contentType.toUpperCase());
} catch (Throwable e) {
type = ContentType.TEXT;
}
switch (type) {
case HTML:
return new HTMLStrategy(config);
case XHTML:
return new XHtmlStrategy(config);
default:
return new PlainTextStrategy(config);
}
|
public org.apache.lucene.document.Field[] | createLuceneField()
return this.strategy.createLuceneField();
|
public void | processIndexable(Indexable indexable)
String path = this.config.getTypePath();
try {
Node node = indexable.applyPath(path);
if (node == null)
this.strategy = new PlainTextStrategy(this.config);
else {
String contentType = node.getTextContent();
this.strategy = chooseStrategy(contentType, this.config);
}
this.strategy.processIndexable(indexable);
} catch (XPathExpressionException e) {
throw new NotIndexableException("Can not apply path -- " + path);
}
|