use of org.opengrok.indexer.analysis.OGKTextField in project OpenGrok by OpenGrok.
the class ELFAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
String fullpath = doc.get("fullpath");
String content;
try (RandomAccessFile raf = new RandomAccessFile(fullpath, "r")) {
content = parseELF(raf.getChannel());
}
if (content != null && !content.isEmpty()) {
doc.add(new OGKTextField(QueryBuilder.FULL, content, Store.NO));
if (xrefOut != null) {
xrefOut.append("</pre>");
Util.htmlize(content, xrefOut);
xrefOut.append("<pre>");
}
}
}
use of org.opengrok.indexer.analysis.OGKTextField in project OpenGrok by OpenGrok.
the class MandocAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
// this is to explicitly use appropriate analyzers tokenstream to
// workaround #1376 symbols search works like full text search
JFlexTokenizer symbolTokenizer = symbolTokenizerFactory.get();
symbolTokenizer.setReader(getReader(src.getStream()));
OGKTextField full = new OGKTextField(QueryBuilder.FULL, symbolTokenizer);
doc.add(full);
if (xrefOut != null) {
try (Reader in = getReader(src.getStream())) {
WriteXrefArgs args = new WriteXrefArgs(in, xrefOut);
args.setProject(project);
Xrefer xref = writeXref(args);
String path = doc.get(QueryBuilder.PATH);
addNumLinesLOC(doc, new NumLinesLOC(path, xref.getLineNumber(), xref.getLOC()));
}
}
}
use of org.opengrok.indexer.analysis.OGKTextField in project OpenGrok by OpenGrok.
the class TroffAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
// this is to explicitly use appropriate analyzers tokenstream to workaround #1376 symbols search works like full text search
JFlexTokenizer symbolTokenizer = symbolTokenizerFactory.get();
symbolTokenizer.setReader(getReader(src.getStream()));
OGKTextField full = new OGKTextField(QueryBuilder.FULL, symbolTokenizer);
doc.add(full);
if (xrefOut != null) {
try (Reader in = getReader(src.getStream())) {
WriteXrefArgs args = new WriteXrefArgs(in, xrefOut);
args.setProject(project);
Xrefer xref = writeXref(args);
String path = doc.get(QueryBuilder.PATH);
addNumLinesLOC(doc, new NumLinesLOC(path, xref.getLineNumber(), xref.getLOC()));
}
}
}
use of org.opengrok.indexer.analysis.OGKTextField in project OpenGrok by OpenGrok.
the class TarAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
ArrayList<String> names = new ArrayList<>();
try (TarInputStream zis = new TarInputStream(src.getStream())) {
TarEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String name = entry.getName();
names.add(name);
if (xrefOut != null) {
Util.htmlize(name, xrefOut);
xrefOut.append("<br/>");
}
}
}
doc.add(new OGKTextField(QueryBuilder.FULL, new IteratorReader(names)));
}
use of org.opengrok.indexer.analysis.OGKTextField in project OpenGrok by OpenGrok.
the class ZipAnalyzer method analyze.
@Override
public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException {
ArrayList<String> names = new ArrayList<>();
try (ZipInputStream zis = new ZipInputStream(src.getStream())) {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String name = entry.getName();
names.add(name);
if (xrefOut != null) {
Util.htmlize(name, xrefOut);
xrefOut.append("<br/>");
}
}
}
doc.add(new OGKTextField(QueryBuilder.FULL, new IteratorReader(names)));
}
Aggregations