diff options
Diffstat (limited to 'vespaclient-container-plugin')
3 files changed, 24 insertions, 13 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java index 045df5558e5..79e2b47c6f3 100755 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/storage/searcher/GetSearcher.java @@ -63,6 +63,14 @@ public class GetSearcher extends Searcher { private static final Logger log = Logger.getLogger(GetSearcher.class.getName()); + private static final CompoundName ID = new CompoundName("id"); + private static final CompoundName HEADERS_ONLY = new CompoundName("headersonly"); + private static final CompoundName POPULATE_HIT_FIELDS = new CompoundName("populatehitfields"); + private static final CompoundName FIELDSET = new CompoundName("fieldset"); + private static final CompoundName FIELD = new CompoundName("field"); + private static final CompoundName CONTENT_TYPE = new CompoundName("contenttype"); + private static final CompoundName TIEMOUT = new CompoundName("timeout"); + FeedContext context; private final long defaultTimeoutMillis; @@ -98,6 +106,10 @@ public class GetSearcher extends Searcher { } public boolean handleReply(Reply reply, int numPending) { + if ((reply.getTrace().getLevel() > 0) && log.isLoggable(LogLevel.DEBUG)) { + String str = reply.getTrace().toString(); + log.log(LogLevel.DEBUG, str); + } if (!reply.hasErrors()) { try { addDocumentHit(reply); @@ -191,7 +203,7 @@ public class GetSearcher extends Searcher { this.defaultTimeoutMillis = defaultTimeoutMillis; } - private void postValidateDocumentIdParameters(Properties properties, int arrayIdsFound) throws Exception { + private static void postValidateDocumentIdParameters(Properties properties, int arrayIdsFound) throws Exception { for (Map.Entry<String, Object> kv : properties.listProperties().entrySet()) { if (!kv.getKey().startsWith("id[")) { continue; @@ -214,7 +226,7 @@ public class GetSearcher extends Searcher { // First check for regular "id=XX" syntax. If found, return vector with that // document id only - String singleId = properties.getString("id"); + String singleId = properties.getString(ID); int index = 0; if (singleId != null) { @@ -230,8 +242,8 @@ public class GetSearcher extends Searcher { docIds.add(docId); ++index; } + postValidateDocumentIdParameters(properties, index); } - postValidateDocumentIdParameters(properties, index); handleData(query.getHttpRequest(), docIds); return docIds; @@ -346,12 +358,12 @@ public class GetSearcher extends Searcher { GetResponse response = new GetResponse(documentIds); Properties properties = query.properties(); - boolean headersOnly = properties.getBoolean("headersonly", false); - boolean populateHitFields = properties.getBoolean("populatehitfields", false); - String fieldSet = properties.getString("fieldset"); - String fieldName = properties.getString("field"); - String contentType = properties.getString("contenttype"); - long timeoutMillis = properties.getString("timeout") != null ? query.getTimeout() : defaultTimeoutMillis; + boolean headersOnly = properties.getBoolean(HEADERS_ONLY, false); + boolean populateHitFields = properties.getBoolean(POPULATE_HIT_FIELDS, false); + String fieldSet = properties.getString(FIELDSET); + String fieldName = properties.getString(FIELD); + String contentType = properties.getString(CONTENT_TYPE); + long timeoutMillis = properties.getString(TIEMOUT) != null ? query.getTimeout() : defaultTimeoutMillis; if (fieldSet == null) { fieldSet = headersOnly ? "[header]" : "[all]"; diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java index c37cb51d7ca..fdfc64d7ba4 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedHandler.java @@ -39,7 +39,7 @@ import java.util.zip.GZIPInputStream; /** * Accept feeds from outside of the Vespa cluster. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen * @since 5.1 */ public class FeedHandler extends LoggingRequestHandler { @@ -79,8 +79,7 @@ public class FeedHandler extends LoggingRequestHandler { /** * Exposed for creating mocks. */ - protected DocumentTypeManager createDocumentManager( - DocumentmanagerConfig documentManagerConfig) { + protected DocumentTypeManager createDocumentManager(DocumentmanagerConfig documentManagerConfig) { return new DocumentTypeManager(documentManagerConfig); } diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java index d762797765b..bdd48949146 100755 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java @@ -477,7 +477,7 @@ public class GetSearcherTestCase { { Result result = new Execution(searchChain, Execution.Context.createContextStub()).search( - newQuery("?id=userdoc:kittens:1:2&id[1]=userdoc:kittens:2:3")); + newQuery("?id[1]=userdoc:kittens:2:3")); assertNotNull(result.hits().getErrorHit()); |