String docUri = summary.getUri(); System.out.println("docURI is " + docUri); if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
System.out.println("Snippet from Summary is " + summary.getFirstSnippetText()); if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
System.out.println(result.getFormat() + ": Format"); System.out.println(result.getUri() + ": Uri");
System.out.println(result.getFormat() + ": Format"); System.out.println(result.getUri() + ": Uri");
if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
if (summary.getFormat().name().equalsIgnoreCase("XML")) { DOMHandle contentHandle = readDocumentUsingDOMHandle(client, docUri, "XML"); Document readDoc = contentHandle.get(); contentHandle = null; else if (summary.getFormat().name().equalsIgnoreCase("JSON")) { JacksonHandle jacksonhandle = new JacksonHandle(); docMgr.read(docUri, jacksonhandle);
System.out.println(result.getFormat() + ": Format"); System.out.println(result.getUri() + ": Uri"); assertTrue("Uri is Wrong", result.getPath().contains("/mime-type/constraint4.json") || result.getPath().contains("/mime-type/constraint4.xml"));
private void checkResults(SearchHandle results) { assertNotNull(results); assertFalse(results.getMetrics().getTotalTime() == -1); MatchDocumentSummary[] summaries = results.getMatchResults(); assertNotNull(summaries); assertTrue(summaries.length > 0); for (MatchDocumentSummary summary : summaries) { assertTrue("Mime type of document", summary.getMimeType().matches("(application|text)/xml")); assertEquals("Format of document", Format.XML, summary.getFormat()); Document relevanceTrace = summary.getRelevanceInfo(); if (relevanceTrace != null) { assertEquals(relevanceTrace.getDocumentElement().getLocalName(),"relevance-info"); } MatchLocation[] locations = summary.getMatchLocations(); for (MatchLocation location : locations) { assertNotNull(location.getAllSnippetText()); } } }
for (MatchDocumentSummary summary : summaries) { ExtractedResult extracted = summary.getExtracted(); if ( Format.JSON == summary.getFormat() ) { for (ExtractedItem item : extracted) { String extractItem = item.getAs(String.class);
for (MatchDocumentSummary summary : summaries1) { ExtractedResult extracted = summary.getExtracted(); if (summary.getFormat() == Format.JSON) { for (ExtractedItem item : extracted) { String stringJsonItem = item.getAs(String.class); if (summary.getFormat() == Format.JSON) { for (ExtractedItem item : extracted) { String stringJsonItem = item.getAs(String.class);
private void checkCts(CtsQueryWriteHandle handle, String optionsName, long numMatches) { RawCtsQueryDefinition rawCtsQueryDefinition; if (optionsName == null) { rawCtsQueryDefinition = queryMgr.newRawCtsQueryDefinition(handle); } else { rawCtsQueryDefinition = queryMgr.newRawCtsQueryDefinition(handle, optionsName); } SearchHandle results; results = queryMgr.search(rawCtsQueryDefinition, new SearchHandle()); assertNotNull(results); assertEquals(results.getTotalResults(), numMatches); assertFalse(results.getMetrics().getTotalTime() == -1); MatchDocumentSummary[] summaries = results.getMatchResults(); assertNotNull(summaries); assertTrue(summaries.length > 0); for (MatchDocumentSummary summary : summaries) { assertTrue("Mime type of document", summary.getMimeType().matches("(application|text)/xml")); assertEquals("Format of document", Format.XML, summary.getFormat()); MatchLocation[] locations = summary.getMatchLocations(); for (MatchLocation location : locations) { assertNotNull(location.getAllSnippetText()); } } }