diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentCollectionContent.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentCollectionContent.java index 1ddd45e..627a6ea 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentCollectionContent.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentCollectionContent.java @@ -125,6 +125,10 @@ protected void writeEntry(JsonWriter jwriter, Document document writeProperty(jwriter, RestServiceConstants.ATTR_UNID, unid); String link = _uri + unid; writeProperty(jwriter, RestServiceConstants.ATTR_HREF, link); + int score = document.getFTSearchScore(); + if (score != 0) { + writeProperty(jwriter, RestServiceConstants.ATTR_SCORE, score); + } } finally { jwriter.endArrayItem(); jwriter.endObject(); diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentContent.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentContent.java index 2395a7c..33ae673 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentContent.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonDocumentContent.java @@ -30,6 +30,7 @@ import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_MODIFIED; import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_NOTEID; import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_PARENTID; +import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_SCORE; import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_TYPE; import static com.ibm.domino.services.rest.RestServiceConstants.ATTR_UNID; import static com.ibm.domino.services.rest.RestServiceConstants.ITEM_FILE; @@ -175,6 +176,13 @@ protected void writeSystemItems(JsonWriter jsonWriter, int sysItem) if ((sysItem & DocumentParameters.SYS_ITEM_AUTHORS)!=0) { writeProperty(jsonWriter, ATTR_AUTHORS, document.getAuthors()); } + if ((sysItem & DocumentParameters.SYS_ITEM_SCORE)!=0) { + int score = document.getFTSearchScore(); + // As this is always a new request/session, score seems always to be 0? + if (score != 0) { + writeProperty(jsonWriter, ATTR_SCORE, document.getFTSearchScore()); + } + } if ((sysItem & DocumentParameters.SYS_ITEM_FORM)!=0) { String form = document.getItemValueString(ITEM_FORM); if (form != null && form.length() > 0) { diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonViewEntryCollectionContent.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonViewEntryCollectionContent.java index 4f78df6..243de1a 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonViewEntryCollectionContent.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/content/JsonViewEntryCollectionContent.java @@ -301,6 +301,16 @@ protected void writeSystemColumns(JsonWriter jsonWriter, int syscol, RestViewNav jsonWriter.endProperty(); } } + if((syscol & ViewParameters.SYSCOL_SCORE)!=0) { + int score = navigator.getScore(); + if(forceDefaultAttributes || score>0) { + jsonWriter.startProperty(ATTR_SCORE); + jsonWriter.outIntLiteral(score); + jsonWriter.endProperty(); + } + } + + } protected void writeColumn(JsonWriter jsonWriter, RestViewNavigator navigator, int colIdx, String colName, Object colValue) throws IOException, ServiceException { diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/RestServiceConstants.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/RestServiceConstants.java index dc2e0e5..ff0e578 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/RestServiceConstants.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/RestServiceConstants.java @@ -32,6 +32,7 @@ public class RestServiceConstants { public static final String ATTR_CONTENT = "content"; //$NON-NLS-1$ public static final String ATTR_MESSAGE = "message"; //$NON-NLS-1$ public static final String ATTR_TYPE = "type"; //$NON-NLS-1$ + public static final String ATTR_SCORE = "@score"; //$NON-NLS-1$ // View service attributes names used in JsonWriter public static final String ATTR_ENTRYID = "@entryid"; //$NON-NLS-1$ @@ -144,6 +145,7 @@ public class RestServiceConstants { public static final String ATTR_XML_COLUMNNUMBER = "columnnumber"; //$NON-NLS-1$ public static final String ATTR_XML_NAME = "name"; //$NON-NLS-1$ public static final String ATTR_XML_VIEWENTRIES = "viewentries"; //$NON-NLS-1$ + public static final String ATTR_XML_SCORE = "score"; //$NON-NLS-1$ public static final String ATTR_XML_VIEWENTRY = ATTR_VIEWENTRY; //$NON-NLS-1$ public static final String ATTR_XML_ENTRYDATA = ATTR_ENTRYDATA; //$NON-NLS-1$ public static final String ATTR_XML_TEXT = ATTR_TEXT; //$NON-NLS-1$ diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/document/DocumentParameters.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/document/DocumentParameters.java index 49a21f2..9b64caa 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/document/DocumentParameters.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/document/DocumentParameters.java @@ -41,6 +41,7 @@ public interface DocumentParameters extends DominoParameters { public static final int SYS_ITEM_AUTHORS = 0x0020; public static final int SYS_ITEM_HIDDEN = 0x0040; public static final int SYS_ITEM_FORM = 0x0080; + public static final int SYS_ITEM_SCORE = 0x0100; public static final int SYS_ITEM_ALL = 0xFFFFFFFF; // Check diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewEntry.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewEntry.java index 8720744..2572c99 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewEntry.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewEntry.java @@ -33,6 +33,7 @@ public interface RestViewEntry { public abstract int getDescendants() throws ServiceException; public abstract int getChildren() throws ServiceException; public abstract int getIndent() throws ServiceException; + public abstract int getScore() throws ServiceException; // Column values public abstract int getColumnCount() throws ServiceException; diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewJsonLegacyService.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewJsonLegacyService.java index 163b9e1..40f1fa2 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewJsonLegacyService.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewJsonLegacyService.java @@ -185,6 +185,16 @@ public void writeSystemIndent(int indent) throws IOException { } g.endProperty(); } + @Override + public void writeSystemScore(int score) throws IOException { + g.startProperty(ATTR_SCORE); + if(jsonTyped) { + g.outIntLiteral(score); + } else { + g.outStringLiteral(Integer.toString(score)); + } + g.endProperty(); + } @Override public void startEntryData() throws IOException { diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewLegacyService.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewLegacyService.java index a21bc43..1b7b605 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewLegacyService.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewLegacyService.java @@ -75,7 +75,8 @@ protected static abstract class LegacyWriter { public abstract void writeSystemDescendants(int count) throws IOException; public abstract void writeSystemChildren(int count) throws IOException; public abstract void writeSystemIndent(int indent) throws IOException; - + public abstract void writeSystemScore(int score) throws IOException; + public abstract void startEntryData() throws IOException; public abstract void endEntryData() throws IOException; @@ -182,8 +183,13 @@ private void writeViewEntry(LegacyWriter g, int syscol, boolean defColumns, List g.writeSystemIndent(indent); } } - - + if((syscol & ViewParameters.SYSCOL_SCORE)!=0) { + int score = nav.getScore(); + if(forceDefaultAttributes || score>0) { + g.writeSystemScore(score); + } + } + g.startEntryData(); // Read the default columns int colidx = 0; diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigator.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigator.java index 08a78d8..816f9f2 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigator.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigator.java @@ -67,6 +67,7 @@ public void recycle() { public abstract int getDescendants() throws ServiceException; public abstract int getChildren() throws ServiceException; public abstract int getIndent() throws ServiceException; + public abstract int getScore() throws ServiceException; public abstract String getForm() throws ServiceException; // Column values diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigatorFactory.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigatorFactory.java index 35dcf53..56ef239 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigatorFactory.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewNavigatorFactory.java @@ -210,6 +210,14 @@ public int getIndent() throws ServiceException { } } @Override + public int getScore() throws ServiceException { + try { + return entry.getFTSearchScore(); + } catch(NotesException ex) { + throw new ServiceException(ex,""); // $NON-NLS-1$ + } + } + @Override public boolean isDocument() throws ServiceException { try { return entry.isDocument(); @@ -376,6 +384,8 @@ protected NOINavigatorForDesign(View view, ViewParameters parameters) throws Not @Override public int getIndent() throws ServiceException {throw new IllegalStateException();} @Override + public int getScore() throws ServiceException {throw new IllegalStateException();} + @Override public int getColumnCount() throws ServiceException {throw new IllegalStateException();} @Override public String getColumnName(int index) throws ServiceException {throw new IllegalStateException();} diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewXmlLegacyService.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewXmlLegacyService.java index 385d9ce..dae5d73 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewXmlLegacyService.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/RestViewXmlLegacyService.java @@ -124,6 +124,10 @@ public void writeSystemChildren(int count) throws IOException { public void writeSystemIndent(int indent) throws IOException { g.writeAttribute(ATTR_XML_INDENT,indent); } + @Override + public void writeSystemScore(int score) throws IOException { + g.writeAttribute(ATTR_XML_SCORE,score); + } @Override public void startEntryData() throws IOException { diff --git a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/ViewParameters.java b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/ViewParameters.java index b4ecf68..ca5686a 100644 --- a/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/ViewParameters.java +++ b/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.services/src/com/ibm/domino/services/rest/das/view/ViewParameters.java @@ -46,6 +46,7 @@ public interface ViewParameters extends DominoParameters { public static final int SYSCOL_RESPONSE = 0x0400; public static final int SYSCOL_HREF = 0x0800; public static final int SYSCOL_LINK = 0x1000; + public static final int SYSCOL_SCORE = 0x2000; //public static final int SYSCOL_ENTRYID = 0x2000; public static final int SYSCOL_ALL = 0xFFFFFFFF;