Browse Source

fix #2739 replace scroll api with /documents/all

Shinsuke Sugaya 2 years ago
parent
commit
aa89150ab7

+ 50 - 0
src/main/config/openapi/openapi-user.yaml

@@ -299,6 +299,56 @@ paths:
         '500':
           $ref: '#/components/responses/InternalServerError'
 
+  /documents/all:
+    get:
+      tags:
+        - search
+      summary: Finds all documents by query
+      description: Finds all documents by search conditions
+      operationId: searchAllDocuments
+      parameters:
+        - name: q
+          in: query
+          description: Search words
+          required: false
+          schema:
+            type: string
+            example: Fess
+        - name: num
+          in: query
+          description: The number of returned documents as a search result
+          required: false
+          schema:
+            type: integer
+            minimum: 0
+            exclusiveMinimum: false
+            maximum: 100
+            exclusiveMaximum: false
+            default: 20
+            example: 20
+        - name: sort
+          in: query
+          description: Sorted field name
+          required: false
+          schema:
+            type: string
+            example: score
+      responses:
+        '200':
+          description: Successful operation
+          content:
+            application/x-ndjson:
+              schema:
+                type: string
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthorized'
+        '404':
+          $ref: '#/components/responses/NotFound'
+        '500':
+          $ref: '#/components/responses/InternalServerError'
+
   /labels:
     get:
       tags:

+ 2 - 4
src/main/java/org/codelibs/fess/api/json/SearchApiManager.java

@@ -124,8 +124,9 @@ public class SearchApiManager extends BaseApiManager {
             if (values.length > 5 && "favorite".equals(values[5])) {
                 request.setAttribute(DOC_ID_FIELD, values[4]);
                 return FormatType.FAVORITE;
+            } else if (values.length > 4 && "all".equals(values[4])) {
+                return FormatType.SCROLL;
             }
-            // return FormatType.SCROLL;
             return FormatType.SEARCH;
         }
         if ("labels".equals(type)) {
@@ -143,9 +144,6 @@ public class SearchApiManager extends BaseApiManager {
         if ("suggest-words".equals(type)) {
             return FormatType.SUGGEST;
         }
-        if ("scroll".equals(type)) {
-            return FormatType.SCROLL;
-        }
         // default
         return FormatType.OTHER;
     }