Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/wonlay/sensei into plugga…

…bleIndex
  • Loading branch information...
commit 7f77313e92d287507733558a6f37c0fc79c70918 2 parents 35a54cb + 375729e
vzhabiuk authored
View
11 sensei-core/src/main/java/com/senseidb/search/req/SenseiError.java
@@ -53,7 +53,12 @@ public ErrorType getErrorType() {
public int getErrorCode() {
return errorCode;
}
-
-
-
+
+ @Override
+ public String toString() {
+ ErrorType et = errorType;
+ if (et == null)
+ et = ErrorType.UnknownError;
+ return String.format("%s(%d): %s", et.name(), errorCode, message);
+ }
}
View
12 sensei-core/src/main/java/com/senseidb/servlet/DefaultSenseiJSONServlet.java
@@ -26,6 +26,10 @@
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_PARTITIONS;
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_QUERY;
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_QUERY_PARAM;
+import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_ERRORS;
+import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_ERROR_CODE;
+import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_ERROR_MESSAGE;
+import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_ERROR_TYPE;
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_FACETS;
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_FACET_INFO_COUNT;
import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_FACET_INFO_SELECTED;
@@ -137,14 +141,6 @@
*/
private static final long serialVersionUID = 1L;
- private static final String PARAM_RESULT_ERROR_MESSAGE = "message";
-
- private static final String PARAM_RESULT_ERROR_TYPE = "errorType";
-
- private static final String PARAM_RESULT_ERRORS = "errors";
-
- private static final String PARAM_RESULT_ERROR_CODE = "errorCode";
-
private static Logger logger = Logger.getLogger(DefaultSenseiJSONServlet.class);
public static JSONObject convertExpl(Explanation expl)
View
8 sensei-core/src/main/java/com/senseidb/servlet/SenseiSearchServletParams.java
@@ -14,7 +14,7 @@
public static final String PARAM_SORT_DOC_REVERSE = "docrev";
public static final String PARAM_FETCH_STORED = "fetchstored";
public static final String PARAM_FETCH_STORED_VALUE = "fetchstoredvalue";
- public static final String PARAM_FETCH_TERMVECTOR = "fetchtermvector";
+ public static final String PARAM_FETCH_TERMVECTOR = "fetchtermvector";
public static final String PARAM_SHOW_EXPLAIN = "showexplain";
public static final String PARAM_ROUTE_PARAM = "routeparam";
public static final String PARAM_GROUP_BY = "groupby";
@@ -48,7 +48,7 @@
public static final String PARAM_RESULT_PARSEDQUERY = "parsedquery";
public static final String PARAM_RESULT_HIT_STORED_FIELDS = "_stored";
- public static final String PARAM_RESULT_HIT_TERMVECTORS = "_termvectors";
+ public static final String PARAM_RESULT_HIT_TERMVECTORS = "_termvectors";
public static final String PARAM_RESULT_HIT_STORED_FIELDS_NAME = "name";
public static final String PARAM_RESULT_HIT_STORED_FIELDS_VALUE = "val";
public static final String PARAM_RESULT_HIT_EXPLANATION = "_explanation";
@@ -58,6 +58,10 @@
public static final String PARAM_RESULT_HIT_GROUPHITS = "grouphits";
public static final String PARAM_RESULT_FACETS = "facets";
+ public static final String PARAM_RESULT_ERRORS = "errors";
+ public static final String PARAM_RESULT_ERROR_CODE = "errorCode";
+ public static final String PARAM_RESULT_ERROR_MESSAGE = "message";
+ public static final String PARAM_RESULT_ERROR_TYPE = "errorType";
public static final String PARAM_RESULT_TID = "tid";
public static final String PARAM_RESULT_TOTALDOCS = "totaldocs";
public static final String PARAM_RESULT_TOTALGROUPS = "totalgroups";
View
9 sensei-core/src/main/java/com/senseidb/svc/impl/CoreSenseiServiceImpl.java
@@ -39,6 +39,8 @@
import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.Timer;
+import static com.senseidb.servlet.SenseiSearchServletParams.PARAM_RESULT_HIT_UID;
+
public class CoreSenseiServiceImpl extends AbstractSenseiCoreService<SenseiRequest, SenseiResult> {
public static final Serializer<SenseiRequest, SenseiResult> JAVA_SERIALIZER =
JavaSerializer.apply("SenseiRequest", SenseiRequest.class, SenseiResult.class);
@@ -95,7 +97,9 @@ private SenseiResult browse(MultiBoboBrowser browser, BrowseRequest req, SubRead
int docid = hit.getDocid();
SubReaderInfo<BoboIndexReader> readerInfo = subReaderAccessor.getSubReaderInfo(docid);
- long uid = (long) ((ZoieIndexReader<BoboIndexReader>) readerInfo.subreader.getInnerReader()).getUID(readerInfo.subdocid);
+ Long uid = (Long)hit.getRawField(PARAM_RESULT_HIT_UID);
+ if (uid == null)
+ uid = ((ZoieIndexReader<BoboIndexReader>) readerInfo.subreader.getInnerReader()).getUID(readerInfo.subdocid);
senseiHit.setUID(uid);
senseiHit.setDocid(docid);
senseiHit.setScore(hit.getScore());
@@ -146,7 +150,6 @@ private SenseiResult browse(MultiBoboBrowser browser, BrowseRequest req, SubRead
@Override
public SenseiResult handlePartitionedRequest(final SenseiRequest request,
List<BoboIndexReader> readerList,SenseiQueryBuilderFactory queryBuilderFactory) throws Exception {
- SubReaderAccessor<BoboIndexReader> subReaderAccessor = ZoieIndexReader.getSubReaderAccessor(readerList);
MultiBoboBrowser browser = null;
try
@@ -182,6 +185,8 @@ public SenseiResult handlePartitionedRequest(final SenseiRequest request,
SenseiMapFunctionWrapper mapWrapper = new SenseiMapFunctionWrapper(request.getMapReduceFunction(), _core.getSystemInfo().getFacetInfos());
breq.setMapReduceWrapper(mapWrapper);
}
+ SubReaderAccessor<BoboIndexReader> subReaderAccessor =
+ ZoieIndexReader.getSubReaderAccessor(validatedSegmentReaders);
SenseiResult res = browse(browser, breq, subReaderAccessor);
int totalDocs = res.getTotalDocs()+skipDocs.get();
res.setTotalDocs(totalDocs);
Please sign in to comment.
Something went wrong with that request. Please try again.