1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.app.web.go;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.lastaflute.web.validation.Required;
22
23 import jakarta.validation.constraints.Size;
24
25 /**
26 * Form class for handling "go" requests that redirect users to specific documents
27 * or search results. This form captures the necessary parameters for document
28 * access tracking and error page fallback information.
29 *
30 */
31 public class GoForm {
32
33 /**
34 * Default constructor for GoForm.
35 */
36 public GoForm() {
37 super();
38 }
39
40 /**
41 * Document identifier for the target document to redirect to.
42 * This is required and limited to 100 characters.
43 */
44 @Required
45 @Size(max = 100)
46 public String docId;
47
48 /**
49 * Redirect target or return URL parameter.
50 * This is required and limited to 10000 characters to accommodate long URLs.
51 */
52 @Size(max = 10000)
53 @Required
54 public String rt;
55
56 /**
57 * Hash value for security or validation purposes.
58 * This field is optional and used for request verification.
59 */
60 public String hash;
61
62 /**
63 * Query identifier associated with the search that led to this document access.
64 * This is required for tracking and analytics purposes.
65 */
66 @Required
67 public String queryId;
68
69 /**
70 * Order or ranking position of the document in search results.
71 * This optional field helps track which result position was clicked.
72 */
73 public Integer order;
74
75 // for error page
76
77 /**
78 * Query string parameter for error page fallback.
79 * Contains the original search query if redirection fails.
80 */
81 public String q;
82
83 /**
84 * Number of results parameter for error page fallback.
85 * Specifies how many results to display if redirection fails.
86 */
87 public String num;
88
89 /**
90 * Sort parameter for error page fallback.
91 * Defines the sorting order if redirection fails.
92 */
93 public String sort;
94
95 /**
96 * Language parameter for error page fallback.
97 * Specifies the language preference if redirection fails.
98 */
99 public String lang;
100
101 /**
102 * Additional fields map for error page fallback.
103 * Contains extra search parameters as key-value pairs if redirection fails.
104 */
105 public Map<String, String[]> fields = new HashMap<>();
106 }