@@ -62,118 +62,118 @@ |
||
| 62 | 62 | interface ISearchTemplate { |
| 63 | 63 | |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Set the class of the icon to be displayed in the left panel of the |
|
| 67 | - * FullTextSearch navigation page, in front of the related Content Provider. |
|
| 68 | - * |
|
| 69 | - * @since 16.0.0 |
|
| 70 | - * |
|
| 71 | - * @param string $class |
|
| 72 | - * |
|
| 73 | - * @return ISearchTemplate |
|
| 74 | - */ |
|
| 75 | - public function setIcon(string $class): ISearchTemplate; |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Get the class of the icon. |
|
| 79 | - * |
|
| 80 | - * @since 16.0.0 |
|
| 81 | - * |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - public function getIcon(): string; |
|
| 85 | - |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Set the path of a CSS file that will be loaded when needed. |
|
| 89 | - * |
|
| 90 | - * @since 16.0.0 |
|
| 91 | - * |
|
| 92 | - * @param string $css |
|
| 93 | - * |
|
| 94 | - * @return ISearchTemplate |
|
| 95 | - */ |
|
| 96 | - public function setCss(string $css): ISearchTemplate; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * Get the path of the CSS file. |
|
| 100 | - * |
|
| 101 | - * @since 16.0.0 |
|
| 102 | - * |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - public function getCss(): string; |
|
| 106 | - |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Set the path of the file of a template that the HTML will be displayed |
|
| 110 | - * below the Options. |
|
| 111 | - * This should only be used if your Content Provider needs to set options in |
|
| 112 | - * a way not generated by FullTextSearch |
|
| 113 | - * |
|
| 114 | - * @since 16.0.0 |
|
| 115 | - * |
|
| 116 | - * @param string $template |
|
| 117 | - * |
|
| 118 | - * @return ISearchTemplate |
|
| 119 | - */ |
|
| 120 | - public function setTemplate(string $template): ISearchTemplate; |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Get the path of the template file. |
|
| 124 | - * |
|
| 125 | - * @since 16.0.0 |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function getTemplate(): string; |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Add an option in the Panel that is displayed when the user start a search |
|
| 134 | - * within the app that generate the content. |
|
| 135 | - * |
|
| 136 | - * @see ISearchOption |
|
| 137 | - * |
|
| 138 | - * @since 16.0.0 |
|
| 139 | - * |
|
| 140 | - * @param ISearchOption $option |
|
| 141 | - * |
|
| 142 | - * @return ISearchTemplate |
|
| 143 | - */ |
|
| 144 | - public function addPanelOption(ISearchOption $option): ISearchTemplate; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Get all options to be displayed in the Panel. |
|
| 148 | - * |
|
| 149 | - * @since 16.0.0 |
|
| 150 | - * |
|
| 151 | - * @return ISearchOption[] |
|
| 152 | - */ |
|
| 153 | - public function getPanelOptions(): array; |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Add an option in the left panel of the FullTextSearch navigation page. |
|
| 158 | - * |
|
| 159 | - * @see ISearchOption |
|
| 160 | - * |
|
| 161 | - * @since 16.0.0 |
|
| 162 | - * |
|
| 163 | - * @param ISearchOption $option |
|
| 164 | - * |
|
| 165 | - * @return ISearchTemplate |
|
| 166 | - */ |
|
| 167 | - public function addNavigationOption(ISearchOption $option): ISearchTemplate; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * Get all options to be displayed in the FullTextSearch navigation page. |
|
| 171 | - * |
|
| 172 | - * @since 16.0.0 |
|
| 173 | - * |
|
| 174 | - * @return array |
|
| 175 | - */ |
|
| 176 | - public function getNavigationOptions(): array; |
|
| 65 | + /** |
|
| 66 | + * Set the class of the icon to be displayed in the left panel of the |
|
| 67 | + * FullTextSearch navigation page, in front of the related Content Provider. |
|
| 68 | + * |
|
| 69 | + * @since 16.0.0 |
|
| 70 | + * |
|
| 71 | + * @param string $class |
|
| 72 | + * |
|
| 73 | + * @return ISearchTemplate |
|
| 74 | + */ |
|
| 75 | + public function setIcon(string $class): ISearchTemplate; |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Get the class of the icon. |
|
| 79 | + * |
|
| 80 | + * @since 16.0.0 |
|
| 81 | + * |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + public function getIcon(): string; |
|
| 85 | + |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Set the path of a CSS file that will be loaded when needed. |
|
| 89 | + * |
|
| 90 | + * @since 16.0.0 |
|
| 91 | + * |
|
| 92 | + * @param string $css |
|
| 93 | + * |
|
| 94 | + * @return ISearchTemplate |
|
| 95 | + */ |
|
| 96 | + public function setCss(string $css): ISearchTemplate; |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * Get the path of the CSS file. |
|
| 100 | + * |
|
| 101 | + * @since 16.0.0 |
|
| 102 | + * |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + public function getCss(): string; |
|
| 106 | + |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Set the path of the file of a template that the HTML will be displayed |
|
| 110 | + * below the Options. |
|
| 111 | + * This should only be used if your Content Provider needs to set options in |
|
| 112 | + * a way not generated by FullTextSearch |
|
| 113 | + * |
|
| 114 | + * @since 16.0.0 |
|
| 115 | + * |
|
| 116 | + * @param string $template |
|
| 117 | + * |
|
| 118 | + * @return ISearchTemplate |
|
| 119 | + */ |
|
| 120 | + public function setTemplate(string $template): ISearchTemplate; |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Get the path of the template file. |
|
| 124 | + * |
|
| 125 | + * @since 16.0.0 |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function getTemplate(): string; |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Add an option in the Panel that is displayed when the user start a search |
|
| 134 | + * within the app that generate the content. |
|
| 135 | + * |
|
| 136 | + * @see ISearchOption |
|
| 137 | + * |
|
| 138 | + * @since 16.0.0 |
|
| 139 | + * |
|
| 140 | + * @param ISearchOption $option |
|
| 141 | + * |
|
| 142 | + * @return ISearchTemplate |
|
| 143 | + */ |
|
| 144 | + public function addPanelOption(ISearchOption $option): ISearchTemplate; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Get all options to be displayed in the Panel. |
|
| 148 | + * |
|
| 149 | + * @since 16.0.0 |
|
| 150 | + * |
|
| 151 | + * @return ISearchOption[] |
|
| 152 | + */ |
|
| 153 | + public function getPanelOptions(): array; |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Add an option in the left panel of the FullTextSearch navigation page. |
|
| 158 | + * |
|
| 159 | + * @see ISearchOption |
|
| 160 | + * |
|
| 161 | + * @since 16.0.0 |
|
| 162 | + * |
|
| 163 | + * @param ISearchOption $option |
|
| 164 | + * |
|
| 165 | + * @return ISearchTemplate |
|
| 166 | + */ |
|
| 167 | + public function addNavigationOption(ISearchOption $option): ISearchTemplate; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * Get all options to be displayed in the FullTextSearch navigation page. |
|
| 171 | + * |
|
| 172 | + * @since 16.0.0 |
|
| 173 | + * |
|
| 174 | + * @return array |
|
| 175 | + */ |
|
| 176 | + public function getNavigationOptions(): array; |
|
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
@@ -54,211 +54,211 @@ |
||
| 54 | 54 | interface IDocumentAccess { |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Owner of the document can be set at the init of the object. |
|
| 59 | - * |
|
| 60 | - * @since 16.0.0 |
|
| 61 | - * |
|
| 62 | - * IDocumentAccess constructor. |
|
| 63 | - * |
|
| 64 | - * @param string $ownerId |
|
| 65 | - */ |
|
| 66 | - public function __construct(string $ownerId = ''); |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Set the Owner of the document. |
|
| 71 | - * |
|
| 72 | - * @since 16.0.0 |
|
| 73 | - * |
|
| 74 | - * @param string $ownerId |
|
| 75 | - * |
|
| 76 | - * @return IDocumentAccess |
|
| 77 | - */ |
|
| 78 | - public function setOwnerId(string $ownerId): IDocumentAccess; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Get the Owner of the document. |
|
| 82 | - * |
|
| 83 | - * @since 16.0.0 |
|
| 84 | - * |
|
| 85 | - * @return string |
|
| 86 | - */ |
|
| 87 | - public function getOwnerId(): string; |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Set the viewer of the document. |
|
| 92 | - * |
|
| 93 | - * @since 16.0.0 |
|
| 94 | - * |
|
| 95 | - * @param string $viewerId |
|
| 96 | - * |
|
| 97 | - * @return IDocumentAccess |
|
| 98 | - */ |
|
| 99 | - public function setViewerId(string $viewerId): IDocumentAccess; |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Get the viewer of the document. |
|
| 103 | - * |
|
| 104 | - * @since 16.0.0 |
|
| 105 | - * |
|
| 106 | - * @return string |
|
| 107 | - */ |
|
| 108 | - public function getViewerId(): string; |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * Set the list of users that have read access to the document. |
|
| 113 | - * |
|
| 114 | - * @since 16.0.0 |
|
| 115 | - * |
|
| 116 | - * @param array $users |
|
| 117 | - * |
|
| 118 | - * @return IDocumentAccess |
|
| 119 | - */ |
|
| 120 | - public function setUsers(array $users): IDocumentAccess; |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Add an entry to the list of users that have read access to the document. |
|
| 124 | - * |
|
| 125 | - * @since 16.0.0 |
|
| 126 | - * |
|
| 127 | - * @param string $user |
|
| 128 | - * |
|
| 129 | - * @return IDocumentAccess |
|
| 130 | - */ |
|
| 131 | - public function addUser(string $user): IDocumentAccess; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Add multiple entries to the list of users that have read access to the |
|
| 135 | - * document. |
|
| 136 | - * |
|
| 137 | - * @since 16.0.0 |
|
| 138 | - * |
|
| 139 | - * @param array $users |
|
| 140 | - * |
|
| 141 | - * @return IDocumentAccess |
|
| 142 | - */ |
|
| 143 | - public function addUsers($users): IDocumentAccess; |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Get the complete list of users that have read access to the document. |
|
| 147 | - * |
|
| 148 | - * @since 16.0.0 |
|
| 149 | - * |
|
| 150 | - * @return array |
|
| 151 | - */ |
|
| 152 | - public function getUsers(): array; |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Set the list of groups that have read access to the document. |
|
| 157 | - * |
|
| 158 | - * @since 16.0.0 |
|
| 159 | - * |
|
| 160 | - * @param array $groups |
|
| 161 | - * |
|
| 162 | - * @return IDocumentAccess |
|
| 163 | - */ |
|
| 164 | - public function setGroups(array $groups): IDocumentAccess; |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Add an entry to the list of groups that have read access to the document. |
|
| 168 | - * |
|
| 169 | - * @since 16.0.0 |
|
| 170 | - * |
|
| 171 | - * @param string $group |
|
| 172 | - * |
|
| 173 | - * @return IDocumentAccess |
|
| 174 | - */ |
|
| 175 | - public function addGroup(string $group): IDocumentAccess; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Add multiple entries to the list of groups that have read access to the |
|
| 179 | - * document. |
|
| 180 | - * |
|
| 181 | - * @since 16.0.0 |
|
| 182 | - * |
|
| 183 | - * @param array $groups |
|
| 184 | - * |
|
| 185 | - * @return IDocumentAccess |
|
| 186 | - */ |
|
| 187 | - public function addGroups(array $groups); |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Get the complete list of groups that have read access to the document. |
|
| 191 | - * |
|
| 192 | - * @since 16.0.0 |
|
| 193 | - * |
|
| 194 | - * @return array |
|
| 195 | - */ |
|
| 196 | - public function getGroups(): array; |
|
| 197 | - |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * Set the list of circles that have read access to the document. |
|
| 201 | - * |
|
| 202 | - * @since 16.0.0 |
|
| 203 | - * |
|
| 204 | - * @param array $circles |
|
| 205 | - * |
|
| 206 | - * @return IDocumentAccess |
|
| 207 | - */ |
|
| 208 | - public function setCircles(array $circles): IDocumentAccess; |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Add an entry to the list of circles that have read access to the document. |
|
| 212 | - * |
|
| 213 | - * @since 16.0.0 |
|
| 214 | - * |
|
| 215 | - * @param string $circle |
|
| 216 | - * |
|
| 217 | - * @return IDocumentAccess |
|
| 218 | - */ |
|
| 219 | - public function addCircle(string $circle): IDocumentAccess; |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * Add multiple entries to the list of groups that have read access to the |
|
| 223 | - * document. |
|
| 224 | - * |
|
| 225 | - * @since 16.0.0 |
|
| 226 | - * |
|
| 227 | - * @param array $circles |
|
| 228 | - * |
|
| 229 | - * @return IDocumentAccess |
|
| 230 | - */ |
|
| 231 | - public function addCircles(array $circles): IDocumentAccess; |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * Get the complete list of circles that have read access to the document. |
|
| 235 | - * |
|
| 236 | - * @since 16.0.0 |
|
| 237 | - * |
|
| 238 | - * @return array |
|
| 239 | - */ |
|
| 240 | - public function getCircles(): array; |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Set the list of links that have read access to the document. |
|
| 245 | - * |
|
| 246 | - * @since 16.0.0 |
|
| 247 | - * |
|
| 248 | - * @param array $links |
|
| 249 | - * |
|
| 250 | - * @return IDocumentAccess |
|
| 251 | - */ |
|
| 252 | - public function setLinks(array $links): IDocumentAccess; |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Get the list of links that have read access to the document. |
|
| 256 | - * |
|
| 257 | - * @since 16.0.0 |
|
| 258 | - * |
|
| 259 | - * @return array |
|
| 260 | - */ |
|
| 261 | - public function getLinks(): array; |
|
| 57 | + /** |
|
| 58 | + * Owner of the document can be set at the init of the object. |
|
| 59 | + * |
|
| 60 | + * @since 16.0.0 |
|
| 61 | + * |
|
| 62 | + * IDocumentAccess constructor. |
|
| 63 | + * |
|
| 64 | + * @param string $ownerId |
|
| 65 | + */ |
|
| 66 | + public function __construct(string $ownerId = ''); |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Set the Owner of the document. |
|
| 71 | + * |
|
| 72 | + * @since 16.0.0 |
|
| 73 | + * |
|
| 74 | + * @param string $ownerId |
|
| 75 | + * |
|
| 76 | + * @return IDocumentAccess |
|
| 77 | + */ |
|
| 78 | + public function setOwnerId(string $ownerId): IDocumentAccess; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Get the Owner of the document. |
|
| 82 | + * |
|
| 83 | + * @since 16.0.0 |
|
| 84 | + * |
|
| 85 | + * @return string |
|
| 86 | + */ |
|
| 87 | + public function getOwnerId(): string; |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Set the viewer of the document. |
|
| 92 | + * |
|
| 93 | + * @since 16.0.0 |
|
| 94 | + * |
|
| 95 | + * @param string $viewerId |
|
| 96 | + * |
|
| 97 | + * @return IDocumentAccess |
|
| 98 | + */ |
|
| 99 | + public function setViewerId(string $viewerId): IDocumentAccess; |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Get the viewer of the document. |
|
| 103 | + * |
|
| 104 | + * @since 16.0.0 |
|
| 105 | + * |
|
| 106 | + * @return string |
|
| 107 | + */ |
|
| 108 | + public function getViewerId(): string; |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * Set the list of users that have read access to the document. |
|
| 113 | + * |
|
| 114 | + * @since 16.0.0 |
|
| 115 | + * |
|
| 116 | + * @param array $users |
|
| 117 | + * |
|
| 118 | + * @return IDocumentAccess |
|
| 119 | + */ |
|
| 120 | + public function setUsers(array $users): IDocumentAccess; |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Add an entry to the list of users that have read access to the document. |
|
| 124 | + * |
|
| 125 | + * @since 16.0.0 |
|
| 126 | + * |
|
| 127 | + * @param string $user |
|
| 128 | + * |
|
| 129 | + * @return IDocumentAccess |
|
| 130 | + */ |
|
| 131 | + public function addUser(string $user): IDocumentAccess; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Add multiple entries to the list of users that have read access to the |
|
| 135 | + * document. |
|
| 136 | + * |
|
| 137 | + * @since 16.0.0 |
|
| 138 | + * |
|
| 139 | + * @param array $users |
|
| 140 | + * |
|
| 141 | + * @return IDocumentAccess |
|
| 142 | + */ |
|
| 143 | + public function addUsers($users): IDocumentAccess; |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Get the complete list of users that have read access to the document. |
|
| 147 | + * |
|
| 148 | + * @since 16.0.0 |
|
| 149 | + * |
|
| 150 | + * @return array |
|
| 151 | + */ |
|
| 152 | + public function getUsers(): array; |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Set the list of groups that have read access to the document. |
|
| 157 | + * |
|
| 158 | + * @since 16.0.0 |
|
| 159 | + * |
|
| 160 | + * @param array $groups |
|
| 161 | + * |
|
| 162 | + * @return IDocumentAccess |
|
| 163 | + */ |
|
| 164 | + public function setGroups(array $groups): IDocumentAccess; |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Add an entry to the list of groups that have read access to the document. |
|
| 168 | + * |
|
| 169 | + * @since 16.0.0 |
|
| 170 | + * |
|
| 171 | + * @param string $group |
|
| 172 | + * |
|
| 173 | + * @return IDocumentAccess |
|
| 174 | + */ |
|
| 175 | + public function addGroup(string $group): IDocumentAccess; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Add multiple entries to the list of groups that have read access to the |
|
| 179 | + * document. |
|
| 180 | + * |
|
| 181 | + * @since 16.0.0 |
|
| 182 | + * |
|
| 183 | + * @param array $groups |
|
| 184 | + * |
|
| 185 | + * @return IDocumentAccess |
|
| 186 | + */ |
|
| 187 | + public function addGroups(array $groups); |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Get the complete list of groups that have read access to the document. |
|
| 191 | + * |
|
| 192 | + * @since 16.0.0 |
|
| 193 | + * |
|
| 194 | + * @return array |
|
| 195 | + */ |
|
| 196 | + public function getGroups(): array; |
|
| 197 | + |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * Set the list of circles that have read access to the document. |
|
| 201 | + * |
|
| 202 | + * @since 16.0.0 |
|
| 203 | + * |
|
| 204 | + * @param array $circles |
|
| 205 | + * |
|
| 206 | + * @return IDocumentAccess |
|
| 207 | + */ |
|
| 208 | + public function setCircles(array $circles): IDocumentAccess; |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Add an entry to the list of circles that have read access to the document. |
|
| 212 | + * |
|
| 213 | + * @since 16.0.0 |
|
| 214 | + * |
|
| 215 | + * @param string $circle |
|
| 216 | + * |
|
| 217 | + * @return IDocumentAccess |
|
| 218 | + */ |
|
| 219 | + public function addCircle(string $circle): IDocumentAccess; |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * Add multiple entries to the list of groups that have read access to the |
|
| 223 | + * document. |
|
| 224 | + * |
|
| 225 | + * @since 16.0.0 |
|
| 226 | + * |
|
| 227 | + * @param array $circles |
|
| 228 | + * |
|
| 229 | + * @return IDocumentAccess |
|
| 230 | + */ |
|
| 231 | + public function addCircles(array $circles): IDocumentAccess; |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * Get the complete list of circles that have read access to the document. |
|
| 235 | + * |
|
| 236 | + * @since 16.0.0 |
|
| 237 | + * |
|
| 238 | + * @return array |
|
| 239 | + */ |
|
| 240 | + public function getCircles(): array; |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Set the list of links that have read access to the document. |
|
| 245 | + * |
|
| 246 | + * @since 16.0.0 |
|
| 247 | + * |
|
| 248 | + * @param array $links |
|
| 249 | + * |
|
| 250 | + * @return IDocumentAccess |
|
| 251 | + */ |
|
| 252 | + public function setLinks(array $links): IDocumentAccess; |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Get the list of links that have read access to the document. |
|
| 256 | + * |
|
| 257 | + * @since 16.0.0 |
|
| 258 | + * |
|
| 259 | + * @return array |
|
| 260 | + */ |
|
| 261 | + public function getLinks(): array; |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | |
@@ -41,131 +41,131 @@ |
||
| 41 | 41 | interface ISearchOption { |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @since 16.0.0 |
|
| 46 | - */ |
|
| 47 | - const CHECKBOX = 'checkbox'; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @since 16.0.0 |
|
| 51 | - */ |
|
| 52 | - const INPUT = 'input'; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @since 16.0.0 |
|
| 56 | - */ |
|
| 57 | - const INPUT_SMALL = 'small'; |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Set the name/key of the option. |
|
| 62 | - * The string should only contains alphanumerical chars and underscore. |
|
| 63 | - * The key can be retrieve when using ISearchRequest::getOption |
|
| 64 | - * |
|
| 65 | - * @see ISearchRequest::getOption |
|
| 66 | - * |
|
| 67 | - * @since 16.0.0 |
|
| 68 | - * |
|
| 69 | - * @param string $name |
|
| 70 | - * |
|
| 71 | - * @return ISearchOption |
|
| 72 | - */ |
|
| 73 | - public function setName(string $name): ISearchOption; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Get the name/key of the option. |
|
| 77 | - * |
|
| 78 | - * @since 16.0.0 |
|
| 79 | - * |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function getName(): string; |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Set the title/display name of the option. |
|
| 87 | - * |
|
| 88 | - * @since 16.0.0 |
|
| 89 | - * |
|
| 90 | - * @param string $title |
|
| 91 | - * |
|
| 92 | - * @return ISearchOption |
|
| 93 | - */ |
|
| 94 | - public function setTitle(string $title): ISearchOption; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Get the title of the option. |
|
| 98 | - * |
|
| 99 | - * @since 16.0.0 |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getTitle(): string; |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Set the type of the option. |
|
| 108 | - * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT |
|
| 109 | - * |
|
| 110 | - * @since 16.0.0 |
|
| 111 | - * |
|
| 112 | - * @param string $type |
|
| 113 | - * |
|
| 114 | - * @return ISearchOption |
|
| 115 | - */ |
|
| 116 | - public function setType(string $type): ISearchOption; |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Get the type of the option. |
|
| 120 | - * |
|
| 121 | - * @since 16.0.0 |
|
| 122 | - * |
|
| 123 | - * @return string |
|
| 124 | - */ |
|
| 125 | - public function getType(): string; |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * In case of Type is INPUT, set the size of the input field. |
|
| 130 | - * Value can be ISearchOption::INPUT_SMALL or not defined. |
|
| 131 | - * |
|
| 132 | - * @since 16.0.0 |
|
| 133 | - * |
|
| 134 | - * @param string $size |
|
| 135 | - * |
|
| 136 | - * @return ISearchOption |
|
| 137 | - */ |
|
| 138 | - public function setSize(string $size): ISearchOption; |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Get the size of the INPUT. |
|
| 142 | - * |
|
| 143 | - * @since 16.0.0 |
|
| 144 | - * |
|
| 145 | - * @return string |
|
| 146 | - */ |
|
| 147 | - public function getSize(): string; |
|
| 148 | - |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * In case of Type is , set the placeholder to be displayed in the input |
|
| 152 | - * field. |
|
| 153 | - * |
|
| 154 | - * @since 16.0.0 |
|
| 155 | - * |
|
| 156 | - * @param string $placeholder |
|
| 157 | - * |
|
| 158 | - * @return ISearchOption |
|
| 159 | - */ |
|
| 160 | - public function setPlaceholder(string $placeholder): ISearchOption; |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Get the placeholder. |
|
| 164 | - * |
|
| 165 | - * @since 16.0.0 |
|
| 166 | - * |
|
| 167 | - * @return string |
|
| 168 | - */ |
|
| 169 | - public function getPlaceholder(): string; |
|
| 44 | + /** |
|
| 45 | + * @since 16.0.0 |
|
| 46 | + */ |
|
| 47 | + const CHECKBOX = 'checkbox'; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @since 16.0.0 |
|
| 51 | + */ |
|
| 52 | + const INPUT = 'input'; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @since 16.0.0 |
|
| 56 | + */ |
|
| 57 | + const INPUT_SMALL = 'small'; |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Set the name/key of the option. |
|
| 62 | + * The string should only contains alphanumerical chars and underscore. |
|
| 63 | + * The key can be retrieve when using ISearchRequest::getOption |
|
| 64 | + * |
|
| 65 | + * @see ISearchRequest::getOption |
|
| 66 | + * |
|
| 67 | + * @since 16.0.0 |
|
| 68 | + * |
|
| 69 | + * @param string $name |
|
| 70 | + * |
|
| 71 | + * @return ISearchOption |
|
| 72 | + */ |
|
| 73 | + public function setName(string $name): ISearchOption; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Get the name/key of the option. |
|
| 77 | + * |
|
| 78 | + * @since 16.0.0 |
|
| 79 | + * |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function getName(): string; |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Set the title/display name of the option. |
|
| 87 | + * |
|
| 88 | + * @since 16.0.0 |
|
| 89 | + * |
|
| 90 | + * @param string $title |
|
| 91 | + * |
|
| 92 | + * @return ISearchOption |
|
| 93 | + */ |
|
| 94 | + public function setTitle(string $title): ISearchOption; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Get the title of the option. |
|
| 98 | + * |
|
| 99 | + * @since 16.0.0 |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getTitle(): string; |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Set the type of the option. |
|
| 108 | + * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT |
|
| 109 | + * |
|
| 110 | + * @since 16.0.0 |
|
| 111 | + * |
|
| 112 | + * @param string $type |
|
| 113 | + * |
|
| 114 | + * @return ISearchOption |
|
| 115 | + */ |
|
| 116 | + public function setType(string $type): ISearchOption; |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Get the type of the option. |
|
| 120 | + * |
|
| 121 | + * @since 16.0.0 |
|
| 122 | + * |
|
| 123 | + * @return string |
|
| 124 | + */ |
|
| 125 | + public function getType(): string; |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * In case of Type is INPUT, set the size of the input field. |
|
| 130 | + * Value can be ISearchOption::INPUT_SMALL or not defined. |
|
| 131 | + * |
|
| 132 | + * @since 16.0.0 |
|
| 133 | + * |
|
| 134 | + * @param string $size |
|
| 135 | + * |
|
| 136 | + * @return ISearchOption |
|
| 137 | + */ |
|
| 138 | + public function setSize(string $size): ISearchOption; |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Get the size of the INPUT. |
|
| 142 | + * |
|
| 143 | + * @since 16.0.0 |
|
| 144 | + * |
|
| 145 | + * @return string |
|
| 146 | + */ |
|
| 147 | + public function getSize(): string; |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * In case of Type is , set the placeholder to be displayed in the input |
|
| 152 | + * field. |
|
| 153 | + * |
|
| 154 | + * @since 16.0.0 |
|
| 155 | + * |
|
| 156 | + * @param string $placeholder |
|
| 157 | + * |
|
| 158 | + * @return ISearchOption |
|
| 159 | + */ |
|
| 160 | + public function setPlaceholder(string $placeholder): ISearchOption; |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Get the placeholder. |
|
| 164 | + * |
|
| 165 | + * @since 16.0.0 |
|
| 166 | + * |
|
| 167 | + * @return string |
|
| 168 | + */ |
|
| 169 | + public function getPlaceholder(): string; |
|
| 170 | 170 | |
| 171 | 171 | } |
@@ -50,587 +50,587 @@ |
||
| 50 | 50 | interface IIndexDocument { |
| 51 | 51 | |
| 52 | 52 | |
| 53 | - const NOT_ENCODED = 0; |
|
| 54 | - const ENCODED_BASE64 = 1; |
|
| 55 | - |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Returns the Id of the original document. |
|
| 60 | - * |
|
| 61 | - * @since 15.0.0 |
|
| 62 | - * |
|
| 63 | - * @return string |
|
| 64 | - */ |
|
| 65 | - public function getId(): string; |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Returns the Id of the provider. |
|
| 70 | - * |
|
| 71 | - * @since 15.0.0 |
|
| 72 | - * |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - public function getProviderId(): string; |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Set the Index related to the IIndexDocument. |
|
| 80 | - * |
|
| 81 | - * @see IIndex |
|
| 82 | - * |
|
| 83 | - * @since 15.0.0 |
|
| 84 | - * |
|
| 85 | - * @param IIndex $index |
|
| 86 | - * |
|
| 87 | - * @return IIndexDocument |
|
| 88 | - */ |
|
| 89 | - public function setIndex(IIndex $index): IIndexDocument; |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Get the Index. |
|
| 93 | - * |
|
| 94 | - * @since 15.0.0 |
|
| 95 | - * |
|
| 96 | - * @return IIndex |
|
| 97 | - */ |
|
| 98 | - public function getIndex(): IIndex; |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * return if Index is defined. |
|
| 102 | - * |
|
| 103 | - * @since 16.0.0 |
|
| 104 | - * |
|
| 105 | - * @return bool |
|
| 106 | - */ |
|
| 107 | - public function hasIndex(): bool; |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Set the modified time of the original document. |
|
| 112 | - * |
|
| 113 | - * @since 15.0.0 |
|
| 114 | - * |
|
| 115 | - * @param int $modifiedTime |
|
| 116 | - * |
|
| 117 | - * @return IIndexDocument |
|
| 118 | - */ |
|
| 119 | - public function setModifiedTime(int $modifiedTime): IIndexDocument; |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Get the modified time of the original document. |
|
| 123 | - * |
|
| 124 | - * @since 15.0.0 |
|
| 125 | - * |
|
| 126 | - * @return int |
|
| 127 | - */ |
|
| 128 | - public function getModifiedTime(): int; |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Check if the original document of the IIndexDocument is older than $time. |
|
| 132 | - * |
|
| 133 | - * @since 15.0.0 |
|
| 134 | - * |
|
| 135 | - * @param int $time |
|
| 136 | - * |
|
| 137 | - * @return bool |
|
| 138 | - */ |
|
| 139 | - public function isOlderThan(int $time): bool; |
|
| 140 | - |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Set the read rights of the original document using a IDocumentAccess. |
|
| 144 | - * |
|
| 145 | - * @see IDocumentAccess |
|
| 146 | - * |
|
| 147 | - * @since 15.0.0 |
|
| 148 | - * |
|
| 149 | - * @param IDocumentAccess $access |
|
| 150 | - * |
|
| 151 | - * @return $this |
|
| 152 | - */ |
|
| 153 | - public function setAccess(IDocumentAccess $access): IIndexDocument; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Get the IDocumentAccess related to the original document. |
|
| 157 | - * |
|
| 158 | - * @since 15.0.0 |
|
| 159 | - * |
|
| 160 | - * @return IDocumentAccess |
|
| 161 | - */ |
|
| 162 | - public function getAccess(): IDocumentAccess; |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Add a tag to the list. |
|
| 167 | - * |
|
| 168 | - * @since 15.0.0 |
|
| 169 | - * |
|
| 170 | - * @param string $tag |
|
| 171 | - * |
|
| 172 | - * @return IIndexDocument |
|
| 173 | - */ |
|
| 174 | - public function addTag(string $tag): IIndexDocument; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Set the list of tags assigned to the original document. |
|
| 178 | - * |
|
| 179 | - * @since 15.0.0 |
|
| 180 | - * |
|
| 181 | - * @param array $tags |
|
| 182 | - * |
|
| 183 | - * @return IIndexDocument |
|
| 184 | - */ |
|
| 185 | - public function setTags(array $tags): IIndexDocument; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * Get the list of tags assigned to the original document. |
|
| 189 | - * |
|
| 190 | - * @since 15.0.0 |
|
| 191 | - * |
|
| 192 | - * @return array |
|
| 193 | - */ |
|
| 194 | - public function getTags(): array; |
|
| 195 | - |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Add a meta tag to the list. |
|
| 199 | - * |
|
| 200 | - * @since 15.0.0 |
|
| 201 | - * |
|
| 202 | - * @param string $tag |
|
| 203 | - * |
|
| 204 | - * @return IIndexDocument |
|
| 205 | - */ |
|
| 206 | - public function addMetaTag(string $tag): IIndexDocument; |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Set the list of meta tags assigned to the original document. |
|
| 210 | - * |
|
| 211 | - * @since 15.0.0 |
|
| 212 | - * |
|
| 213 | - * @param array $tags |
|
| 214 | - * |
|
| 215 | - * @return IIndexDocument |
|
| 216 | - */ |
|
| 217 | - public function setMetaTags(array $tags): IIndexDocument; |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * Get the list of meta tags assigned to the original document. |
|
| 221 | - * |
|
| 222 | - * @since 15.0.0 |
|
| 223 | - * |
|
| 224 | - * @return array |
|
| 225 | - */ |
|
| 226 | - public function getMetaTags(): array; |
|
| 227 | - |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * Add a sub tag to the list. |
|
| 231 | - * |
|
| 232 | - * @since 15.0.0 |
|
| 233 | - * |
|
| 234 | - * @param string $sub |
|
| 235 | - * @param string $tag |
|
| 236 | - * |
|
| 237 | - * @return IIndexDocument |
|
| 238 | - */ |
|
| 239 | - public function addSubTag(string $sub, string $tag): IIndexDocument; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Set the list of sub tags assigned to the original document. |
|
| 243 | - * |
|
| 244 | - * @since 15.0.0 |
|
| 245 | - * |
|
| 246 | - * @param array $tags |
|
| 247 | - * |
|
| 248 | - * @return IIndexDocument |
|
| 249 | - */ |
|
| 250 | - public function setSubTags(array $tags): IIndexDocument; |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * Get the list of sub tags assigned to the original document. |
|
| 254 | - * If $formatted is true, the result will be formatted in a one |
|
| 255 | - * dimensional array. |
|
| 256 | - * |
|
| 257 | - * @since 15.0.0 |
|
| 258 | - * |
|
| 259 | - * @param bool $formatted |
|
| 260 | - * |
|
| 261 | - * @return array |
|
| 262 | - */ |
|
| 263 | - public function getSubTags(bool $formatted = false): array; |
|
| 264 | - |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * Set the source of the original document. |
|
| 268 | - * |
|
| 269 | - * @since 15.0.0 |
|
| 270 | - * |
|
| 271 | - * @param string $source |
|
| 272 | - * |
|
| 273 | - * @return IIndexDocument |
|
| 274 | - */ |
|
| 275 | - public function setSource(string $source): IIndexDocument; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * Get the source of the original document. |
|
| 279 | - * |
|
| 280 | - * @since 15.0.0 |
|
| 281 | - * |
|
| 282 | - * @return string |
|
| 283 | - */ |
|
| 284 | - public function getSource(): string; |
|
| 285 | - |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * Set the title of the original document. |
|
| 289 | - * |
|
| 290 | - * @since 15.0.0 |
|
| 291 | - * |
|
| 292 | - * @param string $title |
|
| 293 | - * |
|
| 294 | - * @return IIndexDocument |
|
| 295 | - */ |
|
| 296 | - public function setTitle(string $title): IIndexDocument; |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * Get the title of the original document. |
|
| 300 | - * |
|
| 301 | - * @since 15.0.0 |
|
| 302 | - * |
|
| 303 | - * @return string |
|
| 304 | - */ |
|
| 305 | - public function getTitle(): string; |
|
| 306 | - |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Set the content of the document. |
|
| 310 | - * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or |
|
| 311 | - * encoded in base64. |
|
| 312 | - * |
|
| 313 | - * @since 15.0.0 |
|
| 314 | - * |
|
| 315 | - * @param string $content |
|
| 316 | - * @param int $encoded |
|
| 317 | - * |
|
| 318 | - * @return IIndexDocument |
|
| 319 | - */ |
|
| 320 | - public function setContent(string $content, int $encoded = 0): IIndexDocument; |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * Get the content of the original document. |
|
| 324 | - * |
|
| 325 | - * @since 15.0.0 |
|
| 326 | - * |
|
| 327 | - * @return string |
|
| 328 | - */ |
|
| 329 | - public function getContent(): string; |
|
| 330 | - |
|
| 331 | - /** |
|
| 332 | - * Returns the type of the encoding on the content. |
|
| 333 | - * |
|
| 334 | - * @since 15.0.0 |
|
| 335 | - * |
|
| 336 | - * @return int |
|
| 337 | - */ |
|
| 338 | - public function isContentEncoded(): int; |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * Return the size of the content. |
|
| 342 | - * |
|
| 343 | - * @since 15.0.0 |
|
| 344 | - * |
|
| 345 | - * @return int |
|
| 346 | - */ |
|
| 347 | - public function getContentSize(): int; |
|
| 348 | - |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * Generate an hash, based on the content of the original document. |
|
| 352 | - * |
|
| 353 | - * @since 15.0.0 |
|
| 354 | - * |
|
| 355 | - * @return IIndexDocument |
|
| 356 | - */ |
|
| 357 | - public function initHash(): IIndexDocument; |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Set the hash of the original document. |
|
| 361 | - * |
|
| 362 | - * @since 15.0.0 |
|
| 363 | - * |
|
| 364 | - * @param string $hash |
|
| 365 | - * |
|
| 366 | - * @return IIndexDocument |
|
| 367 | - */ |
|
| 368 | - public function setHash(string $hash): IIndexDocument; |
|
| 369 | - |
|
| 370 | - /** |
|
| 371 | - * Get the hash of the original document. |
|
| 372 | - * |
|
| 373 | - * @since 15.0.0 |
|
| 374 | - * |
|
| 375 | - * @return string |
|
| 376 | - */ |
|
| 377 | - public function getHash(): string; |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * Add a part, identified by a string, and its content. |
|
| 382 | - * |
|
| 383 | - * It is strongly advised to use alphanumerical chars with no space in the |
|
| 384 | - * $part string. |
|
| 385 | - * |
|
| 386 | - * @since 15.0.0 |
|
| 387 | - * |
|
| 388 | - * @param string $part |
|
| 389 | - * @param string $content |
|
| 390 | - * |
|
| 391 | - * @return IIndexDocument |
|
| 392 | - */ |
|
| 393 | - public function addPart(string $part, string $content): IIndexDocument; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * Set all parts and their content. |
|
| 397 | - * |
|
| 398 | - * @since 15.0.0 |
|
| 399 | - * |
|
| 400 | - * @param array $parts |
|
| 401 | - * |
|
| 402 | - * @return IIndexDocument |
|
| 403 | - */ |
|
| 404 | - public function setParts(array $parts): IIndexDocument; |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * Get all parts of the IIndexDocument. |
|
| 408 | - * |
|
| 409 | - * @since 15.0.0 |
|
| 410 | - * |
|
| 411 | - * @return array |
|
| 412 | - */ |
|
| 413 | - public function getParts(): array; |
|
| 414 | - |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * Add a link, usable by the frontend. |
|
| 418 | - * |
|
| 419 | - * @since 15.0.0 |
|
| 420 | - * |
|
| 421 | - * @param string $link |
|
| 422 | - * |
|
| 423 | - * @return IIndexDocument |
|
| 424 | - */ |
|
| 425 | - public function setLink(string $link): IIndexDocument; |
|
| 426 | - |
|
| 427 | - /** |
|
| 428 | - * Get the link. |
|
| 429 | - * |
|
| 430 | - * @since 15.0.0 |
|
| 431 | - * |
|
| 432 | - * @return string |
|
| 433 | - */ |
|
| 434 | - public function getLink(): string; |
|
| 435 | - |
|
| 436 | - |
|
| 437 | - /** |
|
| 438 | - * Set more information that couldn't be set using other method. |
|
| 439 | - * |
|
| 440 | - * @since 15.0.0 |
|
| 441 | - * |
|
| 442 | - * @param array $more |
|
| 443 | - * |
|
| 444 | - * @return IIndexDocument |
|
| 445 | - */ |
|
| 446 | - public function setMore(array $more): IIndexDocument; |
|
| 447 | - |
|
| 448 | - /** |
|
| 449 | - * Get more information. |
|
| 450 | - * |
|
| 451 | - * @since 15.0.0 |
|
| 452 | - * |
|
| 453 | - * @return array |
|
| 454 | - */ |
|
| 455 | - public function getMore(): array; |
|
| 456 | - |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * Add some excerpt of the content of the original document, usually based |
|
| 460 | - * on the search request. |
|
| 461 | - * |
|
| 462 | - * @since 16.0.0 |
|
| 463 | - * |
|
| 464 | - * @param string $source |
|
| 465 | - * @param string $excerpt |
|
| 466 | - * |
|
| 467 | - * @return IIndexDocument |
|
| 468 | - */ |
|
| 469 | - public function addExcerpt(string $source, string $excerpt): IIndexDocument; |
|
| 470 | - |
|
| 471 | - /** |
|
| 472 | - * Set all excerpts of the content of the original document. |
|
| 473 | - * |
|
| 474 | - * @since 16.0.0 |
|
| 475 | - * |
|
| 476 | - * @param array $excerpts |
|
| 477 | - * |
|
| 478 | - * @return IIndexDocument |
|
| 479 | - */ |
|
| 480 | - public function setExcerpts(array $excerpts): IIndexDocument; |
|
| 481 | - |
|
| 482 | - /** |
|
| 483 | - * Get all excerpts of the content of the original document. |
|
| 484 | - * |
|
| 485 | - * @since 15.0.0 |
|
| 486 | - * |
|
| 487 | - * @return array |
|
| 488 | - */ |
|
| 489 | - public function getExcerpts(): array; |
|
| 490 | - |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * Set the score to the result assigned to this document during a search |
|
| 494 | - * request. |
|
| 495 | - * |
|
| 496 | - * @since 15.0.0 |
|
| 497 | - * |
|
| 498 | - * @param string $score |
|
| 499 | - * |
|
| 500 | - * @return IIndexDocument |
|
| 501 | - */ |
|
| 502 | - public function setScore(string $score): IIndexDocument; |
|
| 503 | - |
|
| 504 | - /** |
|
| 505 | - * Get the score. |
|
| 506 | - * |
|
| 507 | - * @since 15.0.0 |
|
| 508 | - * |
|
| 509 | - * @return string |
|
| 510 | - */ |
|
| 511 | - public function getScore(): string; |
|
| 512 | - |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * Set some information about the original document that will be available |
|
| 516 | - * to the front-end when displaying search result. (as string) |
|
| 517 | - * Because this information will not be indexed, this method can also be |
|
| 518 | - * used to manage some data while filling the IIndexDocument before its |
|
| 519 | - * indexing. |
|
| 520 | - * |
|
| 521 | - * @since 15.0.0 |
|
| 522 | - * |
|
| 523 | - * @param string $info |
|
| 524 | - * @param string $value |
|
| 525 | - * |
|
| 526 | - * @return IIndexDocument |
|
| 527 | - */ |
|
| 528 | - public function setInfo(string $info, string $value): IIndexDocument; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * Get an information about a document. (string) |
|
| 532 | - * |
|
| 533 | - * @since 15.0.0 |
|
| 534 | - * |
|
| 535 | - * @param string $info |
|
| 536 | - * @param string $default |
|
| 537 | - * |
|
| 538 | - * @return string |
|
| 539 | - */ |
|
| 540 | - public function getInfo(string $info, string $default = ''): string; |
|
| 541 | - |
|
| 542 | - /** |
|
| 543 | - * Set some information about the original document that will be available |
|
| 544 | - * to the front-end when displaying search result. (as array) |
|
| 545 | - * Because this information will not be indexed, this method can also be |
|
| 546 | - * used to manage some data while filling the IIndexDocument before its |
|
| 547 | - * indexing. |
|
| 548 | - * |
|
| 549 | - * @since 15.0.0 |
|
| 550 | - * |
|
| 551 | - * @param string $info |
|
| 552 | - * @param array $value |
|
| 553 | - * |
|
| 554 | - * @return IIndexDocument |
|
| 555 | - */ |
|
| 556 | - public function setInfoArray(string $info, array $value): IIndexDocument; |
|
| 557 | - |
|
| 558 | - /** |
|
| 559 | - * Get an information about a document. (array) |
|
| 560 | - * |
|
| 561 | - * @since 15.0.0 |
|
| 562 | - * |
|
| 563 | - * @param string $info |
|
| 564 | - * @param array $default |
|
| 565 | - * |
|
| 566 | - * @return array |
|
| 567 | - */ |
|
| 568 | - public function getInfoArray(string $info, array $default = []): array; |
|
| 569 | - |
|
| 570 | - /** |
|
| 571 | - * Set some information about the original document that will be available |
|
| 572 | - * to the front-end when displaying search result. (as int) |
|
| 573 | - * Because this information will not be indexed, this method can also be |
|
| 574 | - * used to manage some data while filling the IIndexDocument before its |
|
| 575 | - * indexing. |
|
| 576 | - * |
|
| 577 | - * @since 15.0.0 |
|
| 578 | - * |
|
| 579 | - * @param string $info |
|
| 580 | - * @param int $value |
|
| 581 | - * |
|
| 582 | - * @return IIndexDocument |
|
| 583 | - */ |
|
| 584 | - public function setInfoInt(string $info, int $value): IIndexDocument; |
|
| 585 | - |
|
| 586 | - /** |
|
| 587 | - * Get an information about a document. (int) |
|
| 588 | - * |
|
| 589 | - * @since 15.0.0 |
|
| 590 | - * |
|
| 591 | - * @param string $info |
|
| 592 | - * @param int $default |
|
| 593 | - * |
|
| 594 | - * @return int |
|
| 595 | - */ |
|
| 596 | - public function getInfoInt(string $info, int $default = 0): int; |
|
| 597 | - |
|
| 598 | - /** |
|
| 599 | - * Set some information about the original document that will be available |
|
| 600 | - * to the front-end when displaying search result. (as bool) |
|
| 601 | - * Because this information will not be indexed, this method can also be |
|
| 602 | - * used to manage some data while filling the IIndexDocument before its |
|
| 603 | - * indexing. |
|
| 604 | - * |
|
| 605 | - * @since 15.0.0 |
|
| 606 | - * |
|
| 607 | - * @param string $info |
|
| 608 | - * @param bool $value |
|
| 609 | - * |
|
| 610 | - * @return IIndexDocument |
|
| 611 | - */ |
|
| 612 | - public function setInfoBool(string $info, bool $value): IIndexDocument; |
|
| 613 | - |
|
| 614 | - /** |
|
| 615 | - * Get an information about a document. (bool) |
|
| 616 | - * |
|
| 617 | - * @since 15.0.0 |
|
| 618 | - * |
|
| 619 | - * @param string $info |
|
| 620 | - * @param bool $default |
|
| 621 | - * |
|
| 622 | - * @return bool |
|
| 623 | - */ |
|
| 624 | - public function getInfoBool(string $info, bool $default = false): bool; |
|
| 625 | - |
|
| 626 | - /** |
|
| 627 | - * Get all info. |
|
| 628 | - * |
|
| 629 | - * @since 15.0.0 |
|
| 630 | - * |
|
| 631 | - * @return array |
|
| 632 | - */ |
|
| 633 | - public function getInfoAll(): array; |
|
| 53 | + const NOT_ENCODED = 0; |
|
| 54 | + const ENCODED_BASE64 = 1; |
|
| 55 | + |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Returns the Id of the original document. |
|
| 60 | + * |
|
| 61 | + * @since 15.0.0 |
|
| 62 | + * |
|
| 63 | + * @return string |
|
| 64 | + */ |
|
| 65 | + public function getId(): string; |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Returns the Id of the provider. |
|
| 70 | + * |
|
| 71 | + * @since 15.0.0 |
|
| 72 | + * |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + public function getProviderId(): string; |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Set the Index related to the IIndexDocument. |
|
| 80 | + * |
|
| 81 | + * @see IIndex |
|
| 82 | + * |
|
| 83 | + * @since 15.0.0 |
|
| 84 | + * |
|
| 85 | + * @param IIndex $index |
|
| 86 | + * |
|
| 87 | + * @return IIndexDocument |
|
| 88 | + */ |
|
| 89 | + public function setIndex(IIndex $index): IIndexDocument; |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Get the Index. |
|
| 93 | + * |
|
| 94 | + * @since 15.0.0 |
|
| 95 | + * |
|
| 96 | + * @return IIndex |
|
| 97 | + */ |
|
| 98 | + public function getIndex(): IIndex; |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * return if Index is defined. |
|
| 102 | + * |
|
| 103 | + * @since 16.0.0 |
|
| 104 | + * |
|
| 105 | + * @return bool |
|
| 106 | + */ |
|
| 107 | + public function hasIndex(): bool; |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Set the modified time of the original document. |
|
| 112 | + * |
|
| 113 | + * @since 15.0.0 |
|
| 114 | + * |
|
| 115 | + * @param int $modifiedTime |
|
| 116 | + * |
|
| 117 | + * @return IIndexDocument |
|
| 118 | + */ |
|
| 119 | + public function setModifiedTime(int $modifiedTime): IIndexDocument; |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Get the modified time of the original document. |
|
| 123 | + * |
|
| 124 | + * @since 15.0.0 |
|
| 125 | + * |
|
| 126 | + * @return int |
|
| 127 | + */ |
|
| 128 | + public function getModifiedTime(): int; |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Check if the original document of the IIndexDocument is older than $time. |
|
| 132 | + * |
|
| 133 | + * @since 15.0.0 |
|
| 134 | + * |
|
| 135 | + * @param int $time |
|
| 136 | + * |
|
| 137 | + * @return bool |
|
| 138 | + */ |
|
| 139 | + public function isOlderThan(int $time): bool; |
|
| 140 | + |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Set the read rights of the original document using a IDocumentAccess. |
|
| 144 | + * |
|
| 145 | + * @see IDocumentAccess |
|
| 146 | + * |
|
| 147 | + * @since 15.0.0 |
|
| 148 | + * |
|
| 149 | + * @param IDocumentAccess $access |
|
| 150 | + * |
|
| 151 | + * @return $this |
|
| 152 | + */ |
|
| 153 | + public function setAccess(IDocumentAccess $access): IIndexDocument; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Get the IDocumentAccess related to the original document. |
|
| 157 | + * |
|
| 158 | + * @since 15.0.0 |
|
| 159 | + * |
|
| 160 | + * @return IDocumentAccess |
|
| 161 | + */ |
|
| 162 | + public function getAccess(): IDocumentAccess; |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Add a tag to the list. |
|
| 167 | + * |
|
| 168 | + * @since 15.0.0 |
|
| 169 | + * |
|
| 170 | + * @param string $tag |
|
| 171 | + * |
|
| 172 | + * @return IIndexDocument |
|
| 173 | + */ |
|
| 174 | + public function addTag(string $tag): IIndexDocument; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Set the list of tags assigned to the original document. |
|
| 178 | + * |
|
| 179 | + * @since 15.0.0 |
|
| 180 | + * |
|
| 181 | + * @param array $tags |
|
| 182 | + * |
|
| 183 | + * @return IIndexDocument |
|
| 184 | + */ |
|
| 185 | + public function setTags(array $tags): IIndexDocument; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * Get the list of tags assigned to the original document. |
|
| 189 | + * |
|
| 190 | + * @since 15.0.0 |
|
| 191 | + * |
|
| 192 | + * @return array |
|
| 193 | + */ |
|
| 194 | + public function getTags(): array; |
|
| 195 | + |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Add a meta tag to the list. |
|
| 199 | + * |
|
| 200 | + * @since 15.0.0 |
|
| 201 | + * |
|
| 202 | + * @param string $tag |
|
| 203 | + * |
|
| 204 | + * @return IIndexDocument |
|
| 205 | + */ |
|
| 206 | + public function addMetaTag(string $tag): IIndexDocument; |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Set the list of meta tags assigned to the original document. |
|
| 210 | + * |
|
| 211 | + * @since 15.0.0 |
|
| 212 | + * |
|
| 213 | + * @param array $tags |
|
| 214 | + * |
|
| 215 | + * @return IIndexDocument |
|
| 216 | + */ |
|
| 217 | + public function setMetaTags(array $tags): IIndexDocument; |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * Get the list of meta tags assigned to the original document. |
|
| 221 | + * |
|
| 222 | + * @since 15.0.0 |
|
| 223 | + * |
|
| 224 | + * @return array |
|
| 225 | + */ |
|
| 226 | + public function getMetaTags(): array; |
|
| 227 | + |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * Add a sub tag to the list. |
|
| 231 | + * |
|
| 232 | + * @since 15.0.0 |
|
| 233 | + * |
|
| 234 | + * @param string $sub |
|
| 235 | + * @param string $tag |
|
| 236 | + * |
|
| 237 | + * @return IIndexDocument |
|
| 238 | + */ |
|
| 239 | + public function addSubTag(string $sub, string $tag): IIndexDocument; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Set the list of sub tags assigned to the original document. |
|
| 243 | + * |
|
| 244 | + * @since 15.0.0 |
|
| 245 | + * |
|
| 246 | + * @param array $tags |
|
| 247 | + * |
|
| 248 | + * @return IIndexDocument |
|
| 249 | + */ |
|
| 250 | + public function setSubTags(array $tags): IIndexDocument; |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * Get the list of sub tags assigned to the original document. |
|
| 254 | + * If $formatted is true, the result will be formatted in a one |
|
| 255 | + * dimensional array. |
|
| 256 | + * |
|
| 257 | + * @since 15.0.0 |
|
| 258 | + * |
|
| 259 | + * @param bool $formatted |
|
| 260 | + * |
|
| 261 | + * @return array |
|
| 262 | + */ |
|
| 263 | + public function getSubTags(bool $formatted = false): array; |
|
| 264 | + |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * Set the source of the original document. |
|
| 268 | + * |
|
| 269 | + * @since 15.0.0 |
|
| 270 | + * |
|
| 271 | + * @param string $source |
|
| 272 | + * |
|
| 273 | + * @return IIndexDocument |
|
| 274 | + */ |
|
| 275 | + public function setSource(string $source): IIndexDocument; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * Get the source of the original document. |
|
| 279 | + * |
|
| 280 | + * @since 15.0.0 |
|
| 281 | + * |
|
| 282 | + * @return string |
|
| 283 | + */ |
|
| 284 | + public function getSource(): string; |
|
| 285 | + |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * Set the title of the original document. |
|
| 289 | + * |
|
| 290 | + * @since 15.0.0 |
|
| 291 | + * |
|
| 292 | + * @param string $title |
|
| 293 | + * |
|
| 294 | + * @return IIndexDocument |
|
| 295 | + */ |
|
| 296 | + public function setTitle(string $title): IIndexDocument; |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * Get the title of the original document. |
|
| 300 | + * |
|
| 301 | + * @since 15.0.0 |
|
| 302 | + * |
|
| 303 | + * @return string |
|
| 304 | + */ |
|
| 305 | + public function getTitle(): string; |
|
| 306 | + |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Set the content of the document. |
|
| 310 | + * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or |
|
| 311 | + * encoded in base64. |
|
| 312 | + * |
|
| 313 | + * @since 15.0.0 |
|
| 314 | + * |
|
| 315 | + * @param string $content |
|
| 316 | + * @param int $encoded |
|
| 317 | + * |
|
| 318 | + * @return IIndexDocument |
|
| 319 | + */ |
|
| 320 | + public function setContent(string $content, int $encoded = 0): IIndexDocument; |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * Get the content of the original document. |
|
| 324 | + * |
|
| 325 | + * @since 15.0.0 |
|
| 326 | + * |
|
| 327 | + * @return string |
|
| 328 | + */ |
|
| 329 | + public function getContent(): string; |
|
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * Returns the type of the encoding on the content. |
|
| 333 | + * |
|
| 334 | + * @since 15.0.0 |
|
| 335 | + * |
|
| 336 | + * @return int |
|
| 337 | + */ |
|
| 338 | + public function isContentEncoded(): int; |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * Return the size of the content. |
|
| 342 | + * |
|
| 343 | + * @since 15.0.0 |
|
| 344 | + * |
|
| 345 | + * @return int |
|
| 346 | + */ |
|
| 347 | + public function getContentSize(): int; |
|
| 348 | + |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * Generate an hash, based on the content of the original document. |
|
| 352 | + * |
|
| 353 | + * @since 15.0.0 |
|
| 354 | + * |
|
| 355 | + * @return IIndexDocument |
|
| 356 | + */ |
|
| 357 | + public function initHash(): IIndexDocument; |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Set the hash of the original document. |
|
| 361 | + * |
|
| 362 | + * @since 15.0.0 |
|
| 363 | + * |
|
| 364 | + * @param string $hash |
|
| 365 | + * |
|
| 366 | + * @return IIndexDocument |
|
| 367 | + */ |
|
| 368 | + public function setHash(string $hash): IIndexDocument; |
|
| 369 | + |
|
| 370 | + /** |
|
| 371 | + * Get the hash of the original document. |
|
| 372 | + * |
|
| 373 | + * @since 15.0.0 |
|
| 374 | + * |
|
| 375 | + * @return string |
|
| 376 | + */ |
|
| 377 | + public function getHash(): string; |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * Add a part, identified by a string, and its content. |
|
| 382 | + * |
|
| 383 | + * It is strongly advised to use alphanumerical chars with no space in the |
|
| 384 | + * $part string. |
|
| 385 | + * |
|
| 386 | + * @since 15.0.0 |
|
| 387 | + * |
|
| 388 | + * @param string $part |
|
| 389 | + * @param string $content |
|
| 390 | + * |
|
| 391 | + * @return IIndexDocument |
|
| 392 | + */ |
|
| 393 | + public function addPart(string $part, string $content): IIndexDocument; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * Set all parts and their content. |
|
| 397 | + * |
|
| 398 | + * @since 15.0.0 |
|
| 399 | + * |
|
| 400 | + * @param array $parts |
|
| 401 | + * |
|
| 402 | + * @return IIndexDocument |
|
| 403 | + */ |
|
| 404 | + public function setParts(array $parts): IIndexDocument; |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * Get all parts of the IIndexDocument. |
|
| 408 | + * |
|
| 409 | + * @since 15.0.0 |
|
| 410 | + * |
|
| 411 | + * @return array |
|
| 412 | + */ |
|
| 413 | + public function getParts(): array; |
|
| 414 | + |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * Add a link, usable by the frontend. |
|
| 418 | + * |
|
| 419 | + * @since 15.0.0 |
|
| 420 | + * |
|
| 421 | + * @param string $link |
|
| 422 | + * |
|
| 423 | + * @return IIndexDocument |
|
| 424 | + */ |
|
| 425 | + public function setLink(string $link): IIndexDocument; |
|
| 426 | + |
|
| 427 | + /** |
|
| 428 | + * Get the link. |
|
| 429 | + * |
|
| 430 | + * @since 15.0.0 |
|
| 431 | + * |
|
| 432 | + * @return string |
|
| 433 | + */ |
|
| 434 | + public function getLink(): string; |
|
| 435 | + |
|
| 436 | + |
|
| 437 | + /** |
|
| 438 | + * Set more information that couldn't be set using other method. |
|
| 439 | + * |
|
| 440 | + * @since 15.0.0 |
|
| 441 | + * |
|
| 442 | + * @param array $more |
|
| 443 | + * |
|
| 444 | + * @return IIndexDocument |
|
| 445 | + */ |
|
| 446 | + public function setMore(array $more): IIndexDocument; |
|
| 447 | + |
|
| 448 | + /** |
|
| 449 | + * Get more information. |
|
| 450 | + * |
|
| 451 | + * @since 15.0.0 |
|
| 452 | + * |
|
| 453 | + * @return array |
|
| 454 | + */ |
|
| 455 | + public function getMore(): array; |
|
| 456 | + |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * Add some excerpt of the content of the original document, usually based |
|
| 460 | + * on the search request. |
|
| 461 | + * |
|
| 462 | + * @since 16.0.0 |
|
| 463 | + * |
|
| 464 | + * @param string $source |
|
| 465 | + * @param string $excerpt |
|
| 466 | + * |
|
| 467 | + * @return IIndexDocument |
|
| 468 | + */ |
|
| 469 | + public function addExcerpt(string $source, string $excerpt): IIndexDocument; |
|
| 470 | + |
|
| 471 | + /** |
|
| 472 | + * Set all excerpts of the content of the original document. |
|
| 473 | + * |
|
| 474 | + * @since 16.0.0 |
|
| 475 | + * |
|
| 476 | + * @param array $excerpts |
|
| 477 | + * |
|
| 478 | + * @return IIndexDocument |
|
| 479 | + */ |
|
| 480 | + public function setExcerpts(array $excerpts): IIndexDocument; |
|
| 481 | + |
|
| 482 | + /** |
|
| 483 | + * Get all excerpts of the content of the original document. |
|
| 484 | + * |
|
| 485 | + * @since 15.0.0 |
|
| 486 | + * |
|
| 487 | + * @return array |
|
| 488 | + */ |
|
| 489 | + public function getExcerpts(): array; |
|
| 490 | + |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * Set the score to the result assigned to this document during a search |
|
| 494 | + * request. |
|
| 495 | + * |
|
| 496 | + * @since 15.0.0 |
|
| 497 | + * |
|
| 498 | + * @param string $score |
|
| 499 | + * |
|
| 500 | + * @return IIndexDocument |
|
| 501 | + */ |
|
| 502 | + public function setScore(string $score): IIndexDocument; |
|
| 503 | + |
|
| 504 | + /** |
|
| 505 | + * Get the score. |
|
| 506 | + * |
|
| 507 | + * @since 15.0.0 |
|
| 508 | + * |
|
| 509 | + * @return string |
|
| 510 | + */ |
|
| 511 | + public function getScore(): string; |
|
| 512 | + |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * Set some information about the original document that will be available |
|
| 516 | + * to the front-end when displaying search result. (as string) |
|
| 517 | + * Because this information will not be indexed, this method can also be |
|
| 518 | + * used to manage some data while filling the IIndexDocument before its |
|
| 519 | + * indexing. |
|
| 520 | + * |
|
| 521 | + * @since 15.0.0 |
|
| 522 | + * |
|
| 523 | + * @param string $info |
|
| 524 | + * @param string $value |
|
| 525 | + * |
|
| 526 | + * @return IIndexDocument |
|
| 527 | + */ |
|
| 528 | + public function setInfo(string $info, string $value): IIndexDocument; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * Get an information about a document. (string) |
|
| 532 | + * |
|
| 533 | + * @since 15.0.0 |
|
| 534 | + * |
|
| 535 | + * @param string $info |
|
| 536 | + * @param string $default |
|
| 537 | + * |
|
| 538 | + * @return string |
|
| 539 | + */ |
|
| 540 | + public function getInfo(string $info, string $default = ''): string; |
|
| 541 | + |
|
| 542 | + /** |
|
| 543 | + * Set some information about the original document that will be available |
|
| 544 | + * to the front-end when displaying search result. (as array) |
|
| 545 | + * Because this information will not be indexed, this method can also be |
|
| 546 | + * used to manage some data while filling the IIndexDocument before its |
|
| 547 | + * indexing. |
|
| 548 | + * |
|
| 549 | + * @since 15.0.0 |
|
| 550 | + * |
|
| 551 | + * @param string $info |
|
| 552 | + * @param array $value |
|
| 553 | + * |
|
| 554 | + * @return IIndexDocument |
|
| 555 | + */ |
|
| 556 | + public function setInfoArray(string $info, array $value): IIndexDocument; |
|
| 557 | + |
|
| 558 | + /** |
|
| 559 | + * Get an information about a document. (array) |
|
| 560 | + * |
|
| 561 | + * @since 15.0.0 |
|
| 562 | + * |
|
| 563 | + * @param string $info |
|
| 564 | + * @param array $default |
|
| 565 | + * |
|
| 566 | + * @return array |
|
| 567 | + */ |
|
| 568 | + public function getInfoArray(string $info, array $default = []): array; |
|
| 569 | + |
|
| 570 | + /** |
|
| 571 | + * Set some information about the original document that will be available |
|
| 572 | + * to the front-end when displaying search result. (as int) |
|
| 573 | + * Because this information will not be indexed, this method can also be |
|
| 574 | + * used to manage some data while filling the IIndexDocument before its |
|
| 575 | + * indexing. |
|
| 576 | + * |
|
| 577 | + * @since 15.0.0 |
|
| 578 | + * |
|
| 579 | + * @param string $info |
|
| 580 | + * @param int $value |
|
| 581 | + * |
|
| 582 | + * @return IIndexDocument |
|
| 583 | + */ |
|
| 584 | + public function setInfoInt(string $info, int $value): IIndexDocument; |
|
| 585 | + |
|
| 586 | + /** |
|
| 587 | + * Get an information about a document. (int) |
|
| 588 | + * |
|
| 589 | + * @since 15.0.0 |
|
| 590 | + * |
|
| 591 | + * @param string $info |
|
| 592 | + * @param int $default |
|
| 593 | + * |
|
| 594 | + * @return int |
|
| 595 | + */ |
|
| 596 | + public function getInfoInt(string $info, int $default = 0): int; |
|
| 597 | + |
|
| 598 | + /** |
|
| 599 | + * Set some information about the original document that will be available |
|
| 600 | + * to the front-end when displaying search result. (as bool) |
|
| 601 | + * Because this information will not be indexed, this method can also be |
|
| 602 | + * used to manage some data while filling the IIndexDocument before its |
|
| 603 | + * indexing. |
|
| 604 | + * |
|
| 605 | + * @since 15.0.0 |
|
| 606 | + * |
|
| 607 | + * @param string $info |
|
| 608 | + * @param bool $value |
|
| 609 | + * |
|
| 610 | + * @return IIndexDocument |
|
| 611 | + */ |
|
| 612 | + public function setInfoBool(string $info, bool $value): IIndexDocument; |
|
| 613 | + |
|
| 614 | + /** |
|
| 615 | + * Get an information about a document. (bool) |
|
| 616 | + * |
|
| 617 | + * @since 15.0.0 |
|
| 618 | + * |
|
| 619 | + * @param string $info |
|
| 620 | + * @param bool $default |
|
| 621 | + * |
|
| 622 | + * @return bool |
|
| 623 | + */ |
|
| 624 | + public function getInfoBool(string $info, bool $default = false): bool; |
|
| 625 | + |
|
| 626 | + /** |
|
| 627 | + * Get all info. |
|
| 628 | + * |
|
| 629 | + * @since 15.0.0 |
|
| 630 | + * |
|
| 631 | + * @return array |
|
| 632 | + */ |
|
| 633 | + public function getInfoAll(): array; |
|
| 634 | 634 | |
| 635 | 635 | } |
| 636 | 636 | |
@@ -56,143 +56,143 @@ |
||
| 56 | 56 | interface ISearchResult { |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Get the original SearchRequest. |
|
| 61 | - * |
|
| 62 | - * @see ISearchRequest |
|
| 63 | - * |
|
| 64 | - * @since 15.0.0 |
|
| 65 | - * |
|
| 66 | - * @return ISearchRequest |
|
| 67 | - */ |
|
| 68 | - public function getRequest(): ISearchRequest; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Get the targeted Content Provider. |
|
| 72 | - * |
|
| 73 | - * @since 15.0.0 |
|
| 74 | - * |
|
| 75 | - * @return IFullTextSearchProvider |
|
| 76 | - */ |
|
| 77 | - public function getProvider(): IFullTextSearchProvider; |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Add an IIndexDocument as one of the result of the search request. |
|
| 82 | - * |
|
| 83 | - * @since 15.0.0 |
|
| 84 | - * |
|
| 85 | - * @param IIndexDocument $document |
|
| 86 | - * |
|
| 87 | - * @return ISearchResult |
|
| 88 | - */ |
|
| 89 | - public function addDocument(IIndexDocument $document): ISearchResult; |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns all result of the search request, in an array of IIndexDocument. |
|
| 93 | - * |
|
| 94 | - * @since 15.0.0 |
|
| 95 | - * |
|
| 96 | - * @return IIndexDocument[] |
|
| 97 | - */ |
|
| 98 | - public function getDocuments(): array; |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Set an array of IIndexDocument as the result of the search request. |
|
| 102 | - * |
|
| 103 | - * @since 15.0.0 |
|
| 104 | - * |
|
| 105 | - * @param IIndexDocument[] $documents |
|
| 106 | - * |
|
| 107 | - * @return ISearchResult |
|
| 108 | - */ |
|
| 109 | - public function setDocuments(array $documents): ISearchResult; |
|
| 110 | - |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Add an aggregation to the result. |
|
| 114 | - * |
|
| 115 | - * @since 15.0.0 |
|
| 116 | - * |
|
| 117 | - * @param string $category |
|
| 118 | - * @param string $value |
|
| 119 | - * @param int $count |
|
| 120 | - * |
|
| 121 | - * @return ISearchResult |
|
| 122 | - */ |
|
| 123 | - public function addAggregation(string $category, string $value, int $count): ISearchResult; |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * Get all aggregations. |
|
| 127 | - * |
|
| 128 | - * @since 15.0.0 |
|
| 129 | - * |
|
| 130 | - * @param string $category |
|
| 131 | - * |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - public function getAggregations(string $category): array; |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Set the raw result of the request. |
|
| 139 | - * |
|
| 140 | - * @since 15.0.0 |
|
| 141 | - * |
|
| 142 | - * @param string $result |
|
| 143 | - * |
|
| 144 | - * @return ISearchResult |
|
| 145 | - */ |
|
| 146 | - public function setRawResult(string $result): ISearchResult; |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Set the total number of results for the search request. |
|
| 151 | - * Used by pagination. |
|
| 152 | - * |
|
| 153 | - * @since 15.0.0 |
|
| 154 | - * |
|
| 155 | - * @param int $total |
|
| 156 | - * |
|
| 157 | - * @return ISearchResult |
|
| 158 | - */ |
|
| 159 | - public function setTotal(int $total): ISearchResult; |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Set the top score for the search request. |
|
| 164 | - * |
|
| 165 | - * @since 15.0.0 |
|
| 166 | - * |
|
| 167 | - * @param int $score |
|
| 168 | - * |
|
| 169 | - * @return ISearchResult |
|
| 170 | - */ |
|
| 171 | - public function setMaxScore(int $score): ISearchResult; |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Set the time spent by the request to perform the search. |
|
| 176 | - * |
|
| 177 | - * @since 15.0.0 |
|
| 178 | - * |
|
| 179 | - * @param int $time |
|
| 180 | - * |
|
| 181 | - * @return ISearchResult |
|
| 182 | - */ |
|
| 183 | - public function setTime(int $time): ISearchResult; |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Set to true if the request timed out. |
|
| 188 | - * |
|
| 189 | - * @since 15.0.0 |
|
| 190 | - * |
|
| 191 | - * @param bool $timedOut |
|
| 192 | - * |
|
| 193 | - * @return ISearchResult |
|
| 194 | - */ |
|
| 195 | - public function setTimedOut(bool $timedOut): ISearchResult; |
|
| 59 | + /** |
|
| 60 | + * Get the original SearchRequest. |
|
| 61 | + * |
|
| 62 | + * @see ISearchRequest |
|
| 63 | + * |
|
| 64 | + * @since 15.0.0 |
|
| 65 | + * |
|
| 66 | + * @return ISearchRequest |
|
| 67 | + */ |
|
| 68 | + public function getRequest(): ISearchRequest; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Get the targeted Content Provider. |
|
| 72 | + * |
|
| 73 | + * @since 15.0.0 |
|
| 74 | + * |
|
| 75 | + * @return IFullTextSearchProvider |
|
| 76 | + */ |
|
| 77 | + public function getProvider(): IFullTextSearchProvider; |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Add an IIndexDocument as one of the result of the search request. |
|
| 82 | + * |
|
| 83 | + * @since 15.0.0 |
|
| 84 | + * |
|
| 85 | + * @param IIndexDocument $document |
|
| 86 | + * |
|
| 87 | + * @return ISearchResult |
|
| 88 | + */ |
|
| 89 | + public function addDocument(IIndexDocument $document): ISearchResult; |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns all result of the search request, in an array of IIndexDocument. |
|
| 93 | + * |
|
| 94 | + * @since 15.0.0 |
|
| 95 | + * |
|
| 96 | + * @return IIndexDocument[] |
|
| 97 | + */ |
|
| 98 | + public function getDocuments(): array; |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Set an array of IIndexDocument as the result of the search request. |
|
| 102 | + * |
|
| 103 | + * @since 15.0.0 |
|
| 104 | + * |
|
| 105 | + * @param IIndexDocument[] $documents |
|
| 106 | + * |
|
| 107 | + * @return ISearchResult |
|
| 108 | + */ |
|
| 109 | + public function setDocuments(array $documents): ISearchResult; |
|
| 110 | + |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Add an aggregation to the result. |
|
| 114 | + * |
|
| 115 | + * @since 15.0.0 |
|
| 116 | + * |
|
| 117 | + * @param string $category |
|
| 118 | + * @param string $value |
|
| 119 | + * @param int $count |
|
| 120 | + * |
|
| 121 | + * @return ISearchResult |
|
| 122 | + */ |
|
| 123 | + public function addAggregation(string $category, string $value, int $count): ISearchResult; |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * Get all aggregations. |
|
| 127 | + * |
|
| 128 | + * @since 15.0.0 |
|
| 129 | + * |
|
| 130 | + * @param string $category |
|
| 131 | + * |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + public function getAggregations(string $category): array; |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Set the raw result of the request. |
|
| 139 | + * |
|
| 140 | + * @since 15.0.0 |
|
| 141 | + * |
|
| 142 | + * @param string $result |
|
| 143 | + * |
|
| 144 | + * @return ISearchResult |
|
| 145 | + */ |
|
| 146 | + public function setRawResult(string $result): ISearchResult; |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Set the total number of results for the search request. |
|
| 151 | + * Used by pagination. |
|
| 152 | + * |
|
| 153 | + * @since 15.0.0 |
|
| 154 | + * |
|
| 155 | + * @param int $total |
|
| 156 | + * |
|
| 157 | + * @return ISearchResult |
|
| 158 | + */ |
|
| 159 | + public function setTotal(int $total): ISearchResult; |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Set the top score for the search request. |
|
| 164 | + * |
|
| 165 | + * @since 15.0.0 |
|
| 166 | + * |
|
| 167 | + * @param int $score |
|
| 168 | + * |
|
| 169 | + * @return ISearchResult |
|
| 170 | + */ |
|
| 171 | + public function setMaxScore(int $score): ISearchResult; |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Set the time spent by the request to perform the search. |
|
| 176 | + * |
|
| 177 | + * @since 15.0.0 |
|
| 178 | + * |
|
| 179 | + * @param int $time |
|
| 180 | + * |
|
| 181 | + * @return ISearchResult |
|
| 182 | + */ |
|
| 183 | + public function setTime(int $time): ISearchResult; |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Set to true if the request timed out. |
|
| 188 | + * |
|
| 189 | + * @since 15.0.0 |
|
| 190 | + * |
|
| 191 | + * @param bool $timedOut |
|
| 192 | + * |
|
| 193 | + * @return ISearchResult |
|
| 194 | + */ |
|
| 195 | + public function setTimedOut(bool $timedOut): ISearchResult; |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -51,241 +51,241 @@ |
||
| 51 | 51 | interface IIndex { |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - const INDEX_OK = 1; |
|
| 55 | - const INDEX_IGNORE = 2; |
|
| 56 | - |
|
| 57 | - const INDEX_META = 4; |
|
| 58 | - const INDEX_CONTENT = 8; |
|
| 59 | - const INDEX_PARTS = 16; |
|
| 60 | - const INDEX_FULL = 28; |
|
| 61 | - const INDEX_REMOVE = 32; |
|
| 62 | - const INDEX_DONE = 64; |
|
| 63 | - const INDEX_FAILED = 128; |
|
| 64 | - |
|
| 65 | - const ERROR_FAILED = 1; |
|
| 66 | - const ERROR_FAILED2 = 2; |
|
| 67 | - const ERROR_FAILED3 = 4; |
|
| 68 | - |
|
| 69 | - const ERROR_SEV_1 = 1; |
|
| 70 | - const ERROR_SEV_2 = 2; |
|
| 71 | - const ERROR_SEV_3 = 3; |
|
| 72 | - const ERROR_SEV_4 = 4; |
|
| 73 | - |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Get the Id of the Content Provider. |
|
| 77 | - * |
|
| 78 | - * @since 15.0.0 |
|
| 79 | - * |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function getProviderId(): string; |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Get the Id of the original document. |
|
| 87 | - * |
|
| 88 | - * @since 15.0.0 |
|
| 89 | - * |
|
| 90 | - * @return string |
|
| 91 | - */ |
|
| 92 | - public function getDocumentId(): string; |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Set the source of the original document. |
|
| 97 | - * |
|
| 98 | - * @since 15.0.0 |
|
| 99 | - * |
|
| 100 | - * @param string $source |
|
| 101 | - * |
|
| 102 | - * @return IIndex |
|
| 103 | - */ |
|
| 104 | - public function setSource(string $source): IIndex; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Get the source of the original document. |
|
| 108 | - * |
|
| 109 | - * @since 15.0.0 |
|
| 110 | - * |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - public function getSource(): string; |
|
| 114 | - |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Set the owner of the original document. |
|
| 118 | - * |
|
| 119 | - * @since 15.0.0 |
|
| 120 | - * |
|
| 121 | - * @param string $ownerId |
|
| 122 | - * |
|
| 123 | - * @return IIndex |
|
| 124 | - */ |
|
| 125 | - public function setOwnerId(string $ownerId): IIndex; |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Get the owner of the original document. |
|
| 129 | - * |
|
| 130 | - * @since 15.0.0 |
|
| 131 | - * |
|
| 132 | - * @return string |
|
| 133 | - */ |
|
| 134 | - public function getOwnerId(): string; |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Set the current index status (bit flag) of the original document. |
|
| 139 | - * If $reset is true, the status is reset to the defined value. |
|
| 140 | - * |
|
| 141 | - * @since 15.0.0 |
|
| 142 | - * |
|
| 143 | - * @param int $status |
|
| 144 | - * @param bool $reset |
|
| 145 | - * |
|
| 146 | - * @return IIndex |
|
| 147 | - */ |
|
| 148 | - public function setStatus(int $status, bool $reset = false): IIndex; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Get the current index status of the original document. |
|
| 152 | - * |
|
| 153 | - * @since 15.0.0 |
|
| 154 | - * |
|
| 155 | - * @return int |
|
| 156 | - */ |
|
| 157 | - public function getStatus(): int; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Check if the document fit a specific status. |
|
| 161 | - * |
|
| 162 | - * @since 15.0.0 |
|
| 163 | - * |
|
| 164 | - * @param int $status |
|
| 165 | - * |
|
| 166 | - * @return bool |
|
| 167 | - */ |
|
| 168 | - public function isStatus(int $status): bool; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Remove a status. |
|
| 172 | - * |
|
| 173 | - * @since 15.0.0 |
|
| 174 | - * |
|
| 175 | - * @param int $status |
|
| 176 | - * |
|
| 177 | - * @return IIndex |
|
| 178 | - */ |
|
| 179 | - public function unsetStatus(int $status): IIndex; |
|
| 180 | - |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * Add an option related to the original document (as string). |
|
| 184 | - * |
|
| 185 | - * @since 15.0.0 |
|
| 186 | - * |
|
| 187 | - * @param string $option |
|
| 188 | - * @param string|int $value |
|
| 189 | - * |
|
| 190 | - * @return IIndex |
|
| 191 | - */ |
|
| 192 | - public function addOption(string $option, string $value): IIndex; |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Add an option related to the original document (as integer). |
|
| 196 | - * |
|
| 197 | - * @since 15.0.0 |
|
| 198 | - * |
|
| 199 | - * @param string $option |
|
| 200 | - * @param int $value |
|
| 201 | - * |
|
| 202 | - * @return IIndex |
|
| 203 | - */ |
|
| 204 | - public function addOptionInt(string $option, int $value): IIndex; |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Get the option related to the original document (as string). |
|
| 208 | - * |
|
| 209 | - * @since 15.0.0 |
|
| 210 | - * |
|
| 211 | - * @param string $option |
|
| 212 | - * @param string $default |
|
| 213 | - * |
|
| 214 | - * @return string |
|
| 215 | - */ |
|
| 216 | - public function getOption(string $option, string $default = ''): string; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * Get the option related to the original document (as integer). |
|
| 220 | - * |
|
| 221 | - * @since 15.0.0 |
|
| 222 | - * |
|
| 223 | - * @param string $option |
|
| 224 | - * @param int $default |
|
| 225 | - * |
|
| 226 | - * @return int |
|
| 227 | - */ |
|
| 228 | - public function getOptionInt(string $option, int $default = 0): int; |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * Get all options related to the original document. |
|
| 232 | - * |
|
| 233 | - * @since 15.0.0 |
|
| 234 | - * |
|
| 235 | - * @return array |
|
| 236 | - */ |
|
| 237 | - public function getOptions(): array; |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Add an error log related to the Index. |
|
| 242 | - * |
|
| 243 | - * @since 15.0.0 |
|
| 244 | - * |
|
| 245 | - * @param string $message |
|
| 246 | - * @param string $exception |
|
| 247 | - * @param int $sev |
|
| 248 | - * |
|
| 249 | - * @return IIndex |
|
| 250 | - */ |
|
| 251 | - public function addError(string $message, string $exception = '', int $sev = self::ERROR_SEV_3): IIndex; |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Returns the number of known errors related to the Index. |
|
| 255 | - * |
|
| 256 | - * @since 15.0.0 |
|
| 257 | - * |
|
| 258 | - * @return int |
|
| 259 | - */ |
|
| 260 | - public function getErrorCount(): int; |
|
| 261 | - |
|
| 262 | - /** |
|
| 263 | - * Reset all error logs related to the Index. |
|
| 264 | - * |
|
| 265 | - * @since 15.0.0 |
|
| 266 | - */ |
|
| 267 | - public function resetErrors(): IIndex; |
|
| 268 | - |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * Set the date of the last index. |
|
| 272 | - * |
|
| 273 | - * @since 15.0.0 |
|
| 274 | - * |
|
| 275 | - * @param int $lastIndex |
|
| 276 | - * |
|
| 277 | - * @return IIndex |
|
| 278 | - */ |
|
| 279 | - public function setLastIndex(int $lastIndex = -1): IIndex; |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Get the date of the last index. |
|
| 283 | - * |
|
| 284 | - * @since 15.0.0 |
|
| 285 | - * |
|
| 286 | - * @return int |
|
| 287 | - */ |
|
| 288 | - public function getLastIndex(): int; |
|
| 54 | + const INDEX_OK = 1; |
|
| 55 | + const INDEX_IGNORE = 2; |
|
| 56 | + |
|
| 57 | + const INDEX_META = 4; |
|
| 58 | + const INDEX_CONTENT = 8; |
|
| 59 | + const INDEX_PARTS = 16; |
|
| 60 | + const INDEX_FULL = 28; |
|
| 61 | + const INDEX_REMOVE = 32; |
|
| 62 | + const INDEX_DONE = 64; |
|
| 63 | + const INDEX_FAILED = 128; |
|
| 64 | + |
|
| 65 | + const ERROR_FAILED = 1; |
|
| 66 | + const ERROR_FAILED2 = 2; |
|
| 67 | + const ERROR_FAILED3 = 4; |
|
| 68 | + |
|
| 69 | + const ERROR_SEV_1 = 1; |
|
| 70 | + const ERROR_SEV_2 = 2; |
|
| 71 | + const ERROR_SEV_3 = 3; |
|
| 72 | + const ERROR_SEV_4 = 4; |
|
| 73 | + |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Get the Id of the Content Provider. |
|
| 77 | + * |
|
| 78 | + * @since 15.0.0 |
|
| 79 | + * |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function getProviderId(): string; |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Get the Id of the original document. |
|
| 87 | + * |
|
| 88 | + * @since 15.0.0 |
|
| 89 | + * |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 92 | + public function getDocumentId(): string; |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Set the source of the original document. |
|
| 97 | + * |
|
| 98 | + * @since 15.0.0 |
|
| 99 | + * |
|
| 100 | + * @param string $source |
|
| 101 | + * |
|
| 102 | + * @return IIndex |
|
| 103 | + */ |
|
| 104 | + public function setSource(string $source): IIndex; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Get the source of the original document. |
|
| 108 | + * |
|
| 109 | + * @since 15.0.0 |
|
| 110 | + * |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + public function getSource(): string; |
|
| 114 | + |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Set the owner of the original document. |
|
| 118 | + * |
|
| 119 | + * @since 15.0.0 |
|
| 120 | + * |
|
| 121 | + * @param string $ownerId |
|
| 122 | + * |
|
| 123 | + * @return IIndex |
|
| 124 | + */ |
|
| 125 | + public function setOwnerId(string $ownerId): IIndex; |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Get the owner of the original document. |
|
| 129 | + * |
|
| 130 | + * @since 15.0.0 |
|
| 131 | + * |
|
| 132 | + * @return string |
|
| 133 | + */ |
|
| 134 | + public function getOwnerId(): string; |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Set the current index status (bit flag) of the original document. |
|
| 139 | + * If $reset is true, the status is reset to the defined value. |
|
| 140 | + * |
|
| 141 | + * @since 15.0.0 |
|
| 142 | + * |
|
| 143 | + * @param int $status |
|
| 144 | + * @param bool $reset |
|
| 145 | + * |
|
| 146 | + * @return IIndex |
|
| 147 | + */ |
|
| 148 | + public function setStatus(int $status, bool $reset = false): IIndex; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Get the current index status of the original document. |
|
| 152 | + * |
|
| 153 | + * @since 15.0.0 |
|
| 154 | + * |
|
| 155 | + * @return int |
|
| 156 | + */ |
|
| 157 | + public function getStatus(): int; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Check if the document fit a specific status. |
|
| 161 | + * |
|
| 162 | + * @since 15.0.0 |
|
| 163 | + * |
|
| 164 | + * @param int $status |
|
| 165 | + * |
|
| 166 | + * @return bool |
|
| 167 | + */ |
|
| 168 | + public function isStatus(int $status): bool; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Remove a status. |
|
| 172 | + * |
|
| 173 | + * @since 15.0.0 |
|
| 174 | + * |
|
| 175 | + * @param int $status |
|
| 176 | + * |
|
| 177 | + * @return IIndex |
|
| 178 | + */ |
|
| 179 | + public function unsetStatus(int $status): IIndex; |
|
| 180 | + |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * Add an option related to the original document (as string). |
|
| 184 | + * |
|
| 185 | + * @since 15.0.0 |
|
| 186 | + * |
|
| 187 | + * @param string $option |
|
| 188 | + * @param string|int $value |
|
| 189 | + * |
|
| 190 | + * @return IIndex |
|
| 191 | + */ |
|
| 192 | + public function addOption(string $option, string $value): IIndex; |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Add an option related to the original document (as integer). |
|
| 196 | + * |
|
| 197 | + * @since 15.0.0 |
|
| 198 | + * |
|
| 199 | + * @param string $option |
|
| 200 | + * @param int $value |
|
| 201 | + * |
|
| 202 | + * @return IIndex |
|
| 203 | + */ |
|
| 204 | + public function addOptionInt(string $option, int $value): IIndex; |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Get the option related to the original document (as string). |
|
| 208 | + * |
|
| 209 | + * @since 15.0.0 |
|
| 210 | + * |
|
| 211 | + * @param string $option |
|
| 212 | + * @param string $default |
|
| 213 | + * |
|
| 214 | + * @return string |
|
| 215 | + */ |
|
| 216 | + public function getOption(string $option, string $default = ''): string; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * Get the option related to the original document (as integer). |
|
| 220 | + * |
|
| 221 | + * @since 15.0.0 |
|
| 222 | + * |
|
| 223 | + * @param string $option |
|
| 224 | + * @param int $default |
|
| 225 | + * |
|
| 226 | + * @return int |
|
| 227 | + */ |
|
| 228 | + public function getOptionInt(string $option, int $default = 0): int; |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * Get all options related to the original document. |
|
| 232 | + * |
|
| 233 | + * @since 15.0.0 |
|
| 234 | + * |
|
| 235 | + * @return array |
|
| 236 | + */ |
|
| 237 | + public function getOptions(): array; |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Add an error log related to the Index. |
|
| 242 | + * |
|
| 243 | + * @since 15.0.0 |
|
| 244 | + * |
|
| 245 | + * @param string $message |
|
| 246 | + * @param string $exception |
|
| 247 | + * @param int $sev |
|
| 248 | + * |
|
| 249 | + * @return IIndex |
|
| 250 | + */ |
|
| 251 | + public function addError(string $message, string $exception = '', int $sev = self::ERROR_SEV_3): IIndex; |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Returns the number of known errors related to the Index. |
|
| 255 | + * |
|
| 256 | + * @since 15.0.0 |
|
| 257 | + * |
|
| 258 | + * @return int |
|
| 259 | + */ |
|
| 260 | + public function getErrorCount(): int; |
|
| 261 | + |
|
| 262 | + /** |
|
| 263 | + * Reset all error logs related to the Index. |
|
| 264 | + * |
|
| 265 | + * @since 15.0.0 |
|
| 266 | + */ |
|
| 267 | + public function resetErrors(): IIndex; |
|
| 268 | + |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * Set the date of the last index. |
|
| 272 | + * |
|
| 273 | + * @since 15.0.0 |
|
| 274 | + * |
|
| 275 | + * @param int $lastIndex |
|
| 276 | + * |
|
| 277 | + * @return IIndex |
|
| 278 | + */ |
|
| 279 | + public function setLastIndex(int $lastIndex = -1): IIndex; |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Get the date of the last index. |
|
| 283 | + * |
|
| 284 | + * @since 15.0.0 |
|
| 285 | + * |
|
| 286 | + * @return int |
|
| 287 | + */ |
|
| 288 | + public function getLastIndex(): int; |
|
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | } |
@@ -80,147 +80,147 @@ |
||
| 80 | 80 | interface IFullTextSearchPlatform { |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Must returns a unique Id used to identify the Search Platform. |
|
| 85 | - * Id must contains only alphanumeric chars, with no space. |
|
| 86 | - * |
|
| 87 | - * @since 15.0.0 |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function getId(): string; |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Must returns a descriptive name of the Search Platform. |
|
| 96 | - * This is used mainly in the admin settings page to display the list of |
|
| 97 | - * available Search Platform |
|
| 98 | - * |
|
| 99 | - * @since 15.0.0 |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getName(): string; |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * should returns the current configuration of the Search Platform. |
|
| 108 | - * This is used to display the configuration when using the |
|
| 109 | - * ./occ fulltextsearch:check command line. |
|
| 110 | - * |
|
| 111 | - * @since 15.0.0 |
|
| 112 | - * |
|
| 113 | - * @return array |
|
| 114 | - */ |
|
| 115 | - public function getConfiguration(): array; |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Set the wrapper of the currently executed process. |
|
| 120 | - * Because the index process can be long and heavy, and because errors can |
|
| 121 | - * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 122 | - * Search Platform to communicate with the process initiated by |
|
| 123 | - * FullTextSearch. |
|
| 124 | - * |
|
| 125 | - * The IRunner is coming with some methods so the Search Platform can |
|
| 126 | - * returns important information and errors to be displayed to the admin. |
|
| 127 | - * |
|
| 128 | - * @since 15.0.0 |
|
| 129 | - * |
|
| 130 | - * @param IRunner $runner |
|
| 131 | - */ |
|
| 132 | - public function setRunner(IRunner $runner); |
|
| 133 | - |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Called when FullTextSearch is loading your Search Platform. |
|
| 137 | - * |
|
| 138 | - * @since 15.0.0 |
|
| 139 | - */ |
|
| 140 | - public function loadPlatform(); |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Called to check that your Search Platform is correctly configured and that |
|
| 145 | - * This is also the right place to check that the Search Service is available. |
|
| 146 | - * |
|
| 147 | - * @since 15.0.0 |
|
| 148 | - * |
|
| 149 | - * @return bool |
|
| 150 | - */ |
|
| 151 | - public function testPlatform(): bool; |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Called before an index is initiated. |
|
| 156 | - * Best place to initiate some stuff on the Search Server (mapping, ...) |
|
| 157 | - * |
|
| 158 | - * @since 15.0.0 |
|
| 159 | - */ |
|
| 160 | - public function initializeIndex(); |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * Reset the indexes for a specific providerId. |
|
| 165 | - * $providerId can be 'all' if it is a global reset. |
|
| 166 | - * |
|
| 167 | - * @since 15.0.0 |
|
| 168 | - * |
|
| 169 | - * @param string $providerId |
|
| 170 | - */ |
|
| 171 | - public function resetIndex(string $providerId); |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Deleting some IIndex, sent in an array |
|
| 176 | - * |
|
| 177 | - * @see IIndex |
|
| 178 | - * |
|
| 179 | - * @since 15.0.0 |
|
| 180 | - * |
|
| 181 | - * @param IIndex[] $indexes |
|
| 182 | - */ |
|
| 183 | - public function deleteIndexes(array $indexes); |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Indexing a document. |
|
| 188 | - * |
|
| 189 | - * @see IndexDocument |
|
| 190 | - * |
|
| 191 | - * @since 15.0.0 |
|
| 192 | - * |
|
| 193 | - * @param IIndexDocument $document |
|
| 194 | - * |
|
| 195 | - * @return IIndex |
|
| 196 | - */ |
|
| 197 | - public function indexDocument(IIndexDocument $document): IIndex; |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Searching documents, ISearchResult should be updated with the result of |
|
| 202 | - * the search. |
|
| 203 | - * |
|
| 204 | - * @since 15.0.0 |
|
| 205 | - * |
|
| 206 | - * @param ISearchResult $result |
|
| 207 | - * @param IDocumentAccess $access |
|
| 208 | - */ |
|
| 209 | - public function searchRequest(ISearchResult $result, IDocumentAccess $access); |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Return a document based on its Id and the Provider. |
|
| 214 | - * This is used when an admin execute ./occ fulltextsearch:document:platform |
|
| 215 | - * |
|
| 216 | - * @since 15.0.0 |
|
| 217 | - * |
|
| 218 | - * @param string $providerId |
|
| 219 | - * @param string $documentId |
|
| 220 | - * |
|
| 221 | - * @return IIndexDocument |
|
| 222 | - */ |
|
| 223 | - public function getDocument(string $providerId, string $documentId): IIndexDocument; |
|
| 83 | + /** |
|
| 84 | + * Must returns a unique Id used to identify the Search Platform. |
|
| 85 | + * Id must contains only alphanumeric chars, with no space. |
|
| 86 | + * |
|
| 87 | + * @since 15.0.0 |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function getId(): string; |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Must returns a descriptive name of the Search Platform. |
|
| 96 | + * This is used mainly in the admin settings page to display the list of |
|
| 97 | + * available Search Platform |
|
| 98 | + * |
|
| 99 | + * @since 15.0.0 |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getName(): string; |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * should returns the current configuration of the Search Platform. |
|
| 108 | + * This is used to display the configuration when using the |
|
| 109 | + * ./occ fulltextsearch:check command line. |
|
| 110 | + * |
|
| 111 | + * @since 15.0.0 |
|
| 112 | + * |
|
| 113 | + * @return array |
|
| 114 | + */ |
|
| 115 | + public function getConfiguration(): array; |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Set the wrapper of the currently executed process. |
|
| 120 | + * Because the index process can be long and heavy, and because errors can |
|
| 121 | + * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 122 | + * Search Platform to communicate with the process initiated by |
|
| 123 | + * FullTextSearch. |
|
| 124 | + * |
|
| 125 | + * The IRunner is coming with some methods so the Search Platform can |
|
| 126 | + * returns important information and errors to be displayed to the admin. |
|
| 127 | + * |
|
| 128 | + * @since 15.0.0 |
|
| 129 | + * |
|
| 130 | + * @param IRunner $runner |
|
| 131 | + */ |
|
| 132 | + public function setRunner(IRunner $runner); |
|
| 133 | + |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Called when FullTextSearch is loading your Search Platform. |
|
| 137 | + * |
|
| 138 | + * @since 15.0.0 |
|
| 139 | + */ |
|
| 140 | + public function loadPlatform(); |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Called to check that your Search Platform is correctly configured and that |
|
| 145 | + * This is also the right place to check that the Search Service is available. |
|
| 146 | + * |
|
| 147 | + * @since 15.0.0 |
|
| 148 | + * |
|
| 149 | + * @return bool |
|
| 150 | + */ |
|
| 151 | + public function testPlatform(): bool; |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Called before an index is initiated. |
|
| 156 | + * Best place to initiate some stuff on the Search Server (mapping, ...) |
|
| 157 | + * |
|
| 158 | + * @since 15.0.0 |
|
| 159 | + */ |
|
| 160 | + public function initializeIndex(); |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * Reset the indexes for a specific providerId. |
|
| 165 | + * $providerId can be 'all' if it is a global reset. |
|
| 166 | + * |
|
| 167 | + * @since 15.0.0 |
|
| 168 | + * |
|
| 169 | + * @param string $providerId |
|
| 170 | + */ |
|
| 171 | + public function resetIndex(string $providerId); |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Deleting some IIndex, sent in an array |
|
| 176 | + * |
|
| 177 | + * @see IIndex |
|
| 178 | + * |
|
| 179 | + * @since 15.0.0 |
|
| 180 | + * |
|
| 181 | + * @param IIndex[] $indexes |
|
| 182 | + */ |
|
| 183 | + public function deleteIndexes(array $indexes); |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Indexing a document. |
|
| 188 | + * |
|
| 189 | + * @see IndexDocument |
|
| 190 | + * |
|
| 191 | + * @since 15.0.0 |
|
| 192 | + * |
|
| 193 | + * @param IIndexDocument $document |
|
| 194 | + * |
|
| 195 | + * @return IIndex |
|
| 196 | + */ |
|
| 197 | + public function indexDocument(IIndexDocument $document): IIndex; |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Searching documents, ISearchResult should be updated with the result of |
|
| 202 | + * the search. |
|
| 203 | + * |
|
| 204 | + * @since 15.0.0 |
|
| 205 | + * |
|
| 206 | + * @param ISearchResult $result |
|
| 207 | + * @param IDocumentAccess $access |
|
| 208 | + */ |
|
| 209 | + public function searchRequest(ISearchResult $result, IDocumentAccess $access); |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Return a document based on its Id and the Provider. |
|
| 214 | + * This is used when an admin execute ./occ fulltextsearch:document:platform |
|
| 215 | + * |
|
| 216 | + * @since 15.0.0 |
|
| 217 | + * |
|
| 218 | + * @param string $providerId |
|
| 219 | + * @param string $documentId |
|
| 220 | + * |
|
| 221 | + * @return IIndexDocument |
|
| 222 | + */ |
|
| 223 | + public function getDocument(string $providerId, string $documentId): IIndexDocument; |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | } |
@@ -80,245 +80,245 @@ |
||
| 80 | 80 | interface IFullTextSearchProvider { |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Must returns a unique Id used to identify the Content Provider. |
|
| 85 | - * Id must contains only alphanumeric chars, with no space. |
|
| 86 | - * |
|
| 87 | - * @since 15.0.0 |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function getId(): string; |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Must returns a descriptive name of the Content Provider. |
|
| 96 | - * This is used in multiple places, so better use a clear display name. |
|
| 97 | - * |
|
| 98 | - * @since 15.0.0 |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 102 | - public function getName(): string; |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Should returns the current configuration of the Content Provider. |
|
| 107 | - * This is used to display the configuration when using the |
|
| 108 | - * ./occ fulltextsearch:check command line. |
|
| 109 | - * |
|
| 110 | - * @since 15.0.0 |
|
| 111 | - * |
|
| 112 | - * @return array |
|
| 113 | - */ |
|
| 114 | - public function getConfiguration(): array; |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Must returns a ISearchTemplate that contains displayable items and |
|
| 119 | - * available options to users when searching. |
|
| 120 | - * |
|
| 121 | - * @see ISearchTemplate |
|
| 122 | - * |
|
| 123 | - * @since 15.0.0 |
|
| 124 | - * |
|
| 125 | - * @return ISearchTemplate |
|
| 126 | - */ |
|
| 127 | - public function getSearchTemplate(): ISearchTemplate; |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Called when FullTextSearch is loading your Content Provider. |
|
| 132 | - * |
|
| 133 | - * @since 15.0.0 |
|
| 134 | - */ |
|
| 135 | - public function loadProvider(); |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * Set the wrapper of the currently executed process. |
|
| 140 | - * Because the index process can be long and heavy, and because errors can |
|
| 141 | - * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 142 | - * Content Provider to communicate with the process initiated by |
|
| 143 | - * FullTextSearch. |
|
| 144 | - * |
|
| 145 | - * The IRunner is coming with some methods so the Content Provider can |
|
| 146 | - * returns important information and errors to be displayed to the admin. |
|
| 147 | - * |
|
| 148 | - * @since 15.0.0 |
|
| 149 | - * |
|
| 150 | - * @param IRunner $runner |
|
| 151 | - */ |
|
| 152 | - public function setRunner(IRunner $runner); |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * This method is called when the administrator specify options when running |
|
| 157 | - * the ./occ fulltextsearch:index or ./occ fulltextsearch:live |
|
| 158 | - * |
|
| 159 | - * @since 15.0.0 |
|
| 160 | - * |
|
| 161 | - * @param IIndexOptions $options |
|
| 162 | - */ |
|
| 163 | - public function setIndexOptions(IIndexOptions $options); |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Allow the provider to generate a list of chunk to split a huge list of |
|
| 168 | - * indexable documents |
|
| 169 | - * |
|
| 170 | - * During the indexing the generateIndexableDocuments method will be called |
|
| 171 | - * for each entry of the returned array. |
|
| 172 | - * If the returned array is empty, the generateIndexableDocuments() will be |
|
| 173 | - * called only once (per user). |
|
| 174 | - * |
|
| 175 | - * @since 16.0.0 |
|
| 176 | - * |
|
| 177 | - * @param string $userId |
|
| 178 | - * |
|
| 179 | - * @return string[] |
|
| 180 | - */ |
|
| 181 | - public function generateChunks(string $userId): array; |
|
| 182 | - |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * Returns all indexable document for a user as an array of IIndexDocument. |
|
| 186 | - * |
|
| 187 | - * There is no need to fill each IIndexDocument with content; at this point, |
|
| 188 | - * only fill the object with the minimum information to not waste memory while |
|
| 189 | - * still being able to identify the document it is referring to. |
|
| 190 | - * |
|
| 191 | - * FullTextSearch will call 2 other methods of this interface for each |
|
| 192 | - * IIndexDocument of the array, prior to their indexing: |
|
| 193 | - * |
|
| 194 | - * - first, to compare the date of the last index, |
|
| 195 | - * - then, to fill each IIndexDocument with complete data |
|
| 196 | - * |
|
| 197 | - * @see IIndexDocument |
|
| 198 | - * |
|
| 199 | - * @since 15.0.0 |
|
| 200 | - * -> 16.0.0: the parameter "$chunk" was added |
|
| 201 | - * |
|
| 202 | - * @param string $userId |
|
| 203 | - * @param string $chunk |
|
| 204 | - * |
|
| 205 | - * @return IIndexDocument[] |
|
| 206 | - */ |
|
| 207 | - public function generateIndexableDocuments(string $userId, string $chunk): array; |
|
| 208 | - |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Called to verify that the document is not already indexed and that the |
|
| 212 | - * old index is not up-to-date, using the IIndex from |
|
| 213 | - * IIndexDocument->getIndex() |
|
| 214 | - * |
|
| 215 | - * Returning true will not queue the current IIndexDocument to any further |
|
| 216 | - * operation and will continue on the next element from the list returned by |
|
| 217 | - * generateIndexableDocuments(). |
|
| 218 | - * |
|
| 219 | - * @since 15.0.0 |
|
| 220 | - * |
|
| 221 | - * @param IIndexDocument $document |
|
| 222 | - * |
|
| 223 | - * @return bool |
|
| 224 | - */ |
|
| 225 | - public function isDocumentUpToDate(IIndexDocument $document): bool; |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * Must fill IIndexDocument with all information relative to the document, |
|
| 230 | - * before its indexing by the Search Platform. |
|
| 231 | - * |
|
| 232 | - * Method is called for each element returned previously by |
|
| 233 | - * generateIndexableDocuments(). |
|
| 234 | - * |
|
| 235 | - * @see IIndexDocument |
|
| 236 | - * |
|
| 237 | - * @since 15.0.0 |
|
| 238 | - * |
|
| 239 | - * @param IIndexDocument $document |
|
| 240 | - */ |
|
| 241 | - public function fillIndexDocument(IIndexDocument $document); |
|
| 242 | - |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * The Search Provider must create and return an IIndexDocument |
|
| 246 | - * based on the IIndex and its status. The IIndexDocument must contains all |
|
| 247 | - * information as it will be send for indexing. |
|
| 248 | - * |
|
| 249 | - * Method is called during a cron or a ./occ fulltextsearch:live after a |
|
| 250 | - * new document is created, or an old document is set as modified. |
|
| 251 | - * |
|
| 252 | - * @since 15.0.0 |
|
| 253 | - * |
|
| 254 | - * @param IIndex $index |
|
| 255 | - * |
|
| 256 | - * @return IIndexDocument |
|
| 257 | - */ |
|
| 258 | - public function updateDocument(IIndex $index): IIndexDocument; |
|
| 259 | - |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * Called when an index is initiated by the administrator. |
|
| 263 | - * This is should only be used in case of a specific mapping is needed. |
|
| 264 | - * (ie. _almost_ never) |
|
| 265 | - * |
|
| 266 | - * @since 15.0.0 |
|
| 267 | - * |
|
| 268 | - * @param IFullTextSearchPlatform $platform |
|
| 269 | - */ |
|
| 270 | - public function onInitializingIndex(IFullTextSearchPlatform $platform); |
|
| 271 | - |
|
| 272 | - |
|
| 273 | - /** |
|
| 274 | - * Called when administrator is resetting the index. |
|
| 275 | - * This is should only be used in case of a specific mapping has been |
|
| 276 | - * created. |
|
| 277 | - * |
|
| 278 | - * @since 15.0.0 |
|
| 279 | - * |
|
| 280 | - * @param IFullTextSearchPlatform $platform |
|
| 281 | - */ |
|
| 282 | - public function onResettingIndex(IFullTextSearchPlatform $platform); |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * Method is called when a search request is initiated by a user, prior to |
|
| 287 | - * be sent to the Search Platform. |
|
| 288 | - * |
|
| 289 | - * Your Content Provider can interact with the ISearchRequest to apply the |
|
| 290 | - * search options and make the search more precise. |
|
| 291 | - * |
|
| 292 | - * @see ISearchRequest |
|
| 293 | - * |
|
| 294 | - * @since 15.0.0 |
|
| 295 | - * |
|
| 296 | - * @param ISearchRequest $searchRequest |
|
| 297 | - */ |
|
| 298 | - public function improveSearchRequest(ISearchRequest $searchRequest); |
|
| 299 | - |
|
| 300 | - |
|
| 301 | - /** |
|
| 302 | - * Method is called after results of a search are returned by the |
|
| 303 | - * Search Platform. |
|
| 304 | - * |
|
| 305 | - * Your Content Provider can detail each entry with local data to improve |
|
| 306 | - * the display of the search result. |
|
| 307 | - * |
|
| 308 | - * @see ISearchResult |
|
| 309 | - * |
|
| 310 | - * @since 15.0.0 |
|
| 311 | - * |
|
| 312 | - * @param ISearchResult $searchResult |
|
| 313 | - */ |
|
| 314 | - public function improveSearchResult(ISearchResult $searchResult); |
|
| 315 | - |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * not used yet. |
|
| 319 | - * |
|
| 320 | - * @since 15.0.0 |
|
| 321 | - */ |
|
| 322 | - public function unloadProvider(); |
|
| 83 | + /** |
|
| 84 | + * Must returns a unique Id used to identify the Content Provider. |
|
| 85 | + * Id must contains only alphanumeric chars, with no space. |
|
| 86 | + * |
|
| 87 | + * @since 15.0.0 |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function getId(): string; |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Must returns a descriptive name of the Content Provider. |
|
| 96 | + * This is used in multiple places, so better use a clear display name. |
|
| 97 | + * |
|
| 98 | + * @since 15.0.0 |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | + public function getName(): string; |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Should returns the current configuration of the Content Provider. |
|
| 107 | + * This is used to display the configuration when using the |
|
| 108 | + * ./occ fulltextsearch:check command line. |
|
| 109 | + * |
|
| 110 | + * @since 15.0.0 |
|
| 111 | + * |
|
| 112 | + * @return array |
|
| 113 | + */ |
|
| 114 | + public function getConfiguration(): array; |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Must returns a ISearchTemplate that contains displayable items and |
|
| 119 | + * available options to users when searching. |
|
| 120 | + * |
|
| 121 | + * @see ISearchTemplate |
|
| 122 | + * |
|
| 123 | + * @since 15.0.0 |
|
| 124 | + * |
|
| 125 | + * @return ISearchTemplate |
|
| 126 | + */ |
|
| 127 | + public function getSearchTemplate(): ISearchTemplate; |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Called when FullTextSearch is loading your Content Provider. |
|
| 132 | + * |
|
| 133 | + * @since 15.0.0 |
|
| 134 | + */ |
|
| 135 | + public function loadProvider(); |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * Set the wrapper of the currently executed process. |
|
| 140 | + * Because the index process can be long and heavy, and because errors can |
|
| 141 | + * be encountered during the process, the IRunner is a wrapper that allow the |
|
| 142 | + * Content Provider to communicate with the process initiated by |
|
| 143 | + * FullTextSearch. |
|
| 144 | + * |
|
| 145 | + * The IRunner is coming with some methods so the Content Provider can |
|
| 146 | + * returns important information and errors to be displayed to the admin. |
|
| 147 | + * |
|
| 148 | + * @since 15.0.0 |
|
| 149 | + * |
|
| 150 | + * @param IRunner $runner |
|
| 151 | + */ |
|
| 152 | + public function setRunner(IRunner $runner); |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * This method is called when the administrator specify options when running |
|
| 157 | + * the ./occ fulltextsearch:index or ./occ fulltextsearch:live |
|
| 158 | + * |
|
| 159 | + * @since 15.0.0 |
|
| 160 | + * |
|
| 161 | + * @param IIndexOptions $options |
|
| 162 | + */ |
|
| 163 | + public function setIndexOptions(IIndexOptions $options); |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Allow the provider to generate a list of chunk to split a huge list of |
|
| 168 | + * indexable documents |
|
| 169 | + * |
|
| 170 | + * During the indexing the generateIndexableDocuments method will be called |
|
| 171 | + * for each entry of the returned array. |
|
| 172 | + * If the returned array is empty, the generateIndexableDocuments() will be |
|
| 173 | + * called only once (per user). |
|
| 174 | + * |
|
| 175 | + * @since 16.0.0 |
|
| 176 | + * |
|
| 177 | + * @param string $userId |
|
| 178 | + * |
|
| 179 | + * @return string[] |
|
| 180 | + */ |
|
| 181 | + public function generateChunks(string $userId): array; |
|
| 182 | + |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * Returns all indexable document for a user as an array of IIndexDocument. |
|
| 186 | + * |
|
| 187 | + * There is no need to fill each IIndexDocument with content; at this point, |
|
| 188 | + * only fill the object with the minimum information to not waste memory while |
|
| 189 | + * still being able to identify the document it is referring to. |
|
| 190 | + * |
|
| 191 | + * FullTextSearch will call 2 other methods of this interface for each |
|
| 192 | + * IIndexDocument of the array, prior to their indexing: |
|
| 193 | + * |
|
| 194 | + * - first, to compare the date of the last index, |
|
| 195 | + * - then, to fill each IIndexDocument with complete data |
|
| 196 | + * |
|
| 197 | + * @see IIndexDocument |
|
| 198 | + * |
|
| 199 | + * @since 15.0.0 |
|
| 200 | + * -> 16.0.0: the parameter "$chunk" was added |
|
| 201 | + * |
|
| 202 | + * @param string $userId |
|
| 203 | + * @param string $chunk |
|
| 204 | + * |
|
| 205 | + * @return IIndexDocument[] |
|
| 206 | + */ |
|
| 207 | + public function generateIndexableDocuments(string $userId, string $chunk): array; |
|
| 208 | + |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Called to verify that the document is not already indexed and that the |
|
| 212 | + * old index is not up-to-date, using the IIndex from |
|
| 213 | + * IIndexDocument->getIndex() |
|
| 214 | + * |
|
| 215 | + * Returning true will not queue the current IIndexDocument to any further |
|
| 216 | + * operation and will continue on the next element from the list returned by |
|
| 217 | + * generateIndexableDocuments(). |
|
| 218 | + * |
|
| 219 | + * @since 15.0.0 |
|
| 220 | + * |
|
| 221 | + * @param IIndexDocument $document |
|
| 222 | + * |
|
| 223 | + * @return bool |
|
| 224 | + */ |
|
| 225 | + public function isDocumentUpToDate(IIndexDocument $document): bool; |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * Must fill IIndexDocument with all information relative to the document, |
|
| 230 | + * before its indexing by the Search Platform. |
|
| 231 | + * |
|
| 232 | + * Method is called for each element returned previously by |
|
| 233 | + * generateIndexableDocuments(). |
|
| 234 | + * |
|
| 235 | + * @see IIndexDocument |
|
| 236 | + * |
|
| 237 | + * @since 15.0.0 |
|
| 238 | + * |
|
| 239 | + * @param IIndexDocument $document |
|
| 240 | + */ |
|
| 241 | + public function fillIndexDocument(IIndexDocument $document); |
|
| 242 | + |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * The Search Provider must create and return an IIndexDocument |
|
| 246 | + * based on the IIndex and its status. The IIndexDocument must contains all |
|
| 247 | + * information as it will be send for indexing. |
|
| 248 | + * |
|
| 249 | + * Method is called during a cron or a ./occ fulltextsearch:live after a |
|
| 250 | + * new document is created, or an old document is set as modified. |
|
| 251 | + * |
|
| 252 | + * @since 15.0.0 |
|
| 253 | + * |
|
| 254 | + * @param IIndex $index |
|
| 255 | + * |
|
| 256 | + * @return IIndexDocument |
|
| 257 | + */ |
|
| 258 | + public function updateDocument(IIndex $index): IIndexDocument; |
|
| 259 | + |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Called when an index is initiated by the administrator. |
|
| 263 | + * This is should only be used in case of a specific mapping is needed. |
|
| 264 | + * (ie. _almost_ never) |
|
| 265 | + * |
|
| 266 | + * @since 15.0.0 |
|
| 267 | + * |
|
| 268 | + * @param IFullTextSearchPlatform $platform |
|
| 269 | + */ |
|
| 270 | + public function onInitializingIndex(IFullTextSearchPlatform $platform); |
|
| 271 | + |
|
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * Called when administrator is resetting the index. |
|
| 275 | + * This is should only be used in case of a specific mapping has been |
|
| 276 | + * created. |
|
| 277 | + * |
|
| 278 | + * @since 15.0.0 |
|
| 279 | + * |
|
| 280 | + * @param IFullTextSearchPlatform $platform |
|
| 281 | + */ |
|
| 282 | + public function onResettingIndex(IFullTextSearchPlatform $platform); |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * Method is called when a search request is initiated by a user, prior to |
|
| 287 | + * be sent to the Search Platform. |
|
| 288 | + * |
|
| 289 | + * Your Content Provider can interact with the ISearchRequest to apply the |
|
| 290 | + * search options and make the search more precise. |
|
| 291 | + * |
|
| 292 | + * @see ISearchRequest |
|
| 293 | + * |
|
| 294 | + * @since 15.0.0 |
|
| 295 | + * |
|
| 296 | + * @param ISearchRequest $searchRequest |
|
| 297 | + */ |
|
| 298 | + public function improveSearchRequest(ISearchRequest $searchRequest); |
|
| 299 | + |
|
| 300 | + |
|
| 301 | + /** |
|
| 302 | + * Method is called after results of a search are returned by the |
|
| 303 | + * Search Platform. |
|
| 304 | + * |
|
| 305 | + * Your Content Provider can detail each entry with local data to improve |
|
| 306 | + * the display of the search result. |
|
| 307 | + * |
|
| 308 | + * @see ISearchResult |
|
| 309 | + * |
|
| 310 | + * @since 15.0.0 |
|
| 311 | + * |
|
| 312 | + * @param ISearchResult $searchResult |
|
| 313 | + */ |
|
| 314 | + public function improveSearchResult(ISearchResult $searchResult); |
|
| 315 | + |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * not used yet. |
|
| 319 | + * |
|
| 320 | + * @since 15.0.0 |
|
| 321 | + */ |
|
| 322 | + public function unloadProvider(); |
|
| 323 | 323 | |
| 324 | 324 | } |
@@ -45,247 +45,247 @@ |
||
| 45 | 45 | final class SearchOption implements ISearchOption, JsonSerializable { |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /** @var string */ |
|
| 49 | - private $name = ''; |
|
| 50 | - |
|
| 51 | - /** @var string */ |
|
| 52 | - private $title = ''; |
|
| 53 | - |
|
| 54 | - /** @var string */ |
|
| 55 | - private $type = ''; |
|
| 56 | - |
|
| 57 | - /** @var string */ |
|
| 58 | - private $size = ''; |
|
| 59 | - |
|
| 60 | - /** @var string */ |
|
| 61 | - private $placeholder = ''; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * * |
|
| 66 | - * |
|
| 67 | - * The array can be empty in case no search options are available. |
|
| 68 | - * The format of the array must be like this: |
|
| 69 | - * |
|
| 70 | - * [ |
|
| 71 | - * 'panel' => [ |
|
| 72 | - * 'options' => [ |
|
| 73 | - * OPTION1, |
|
| 74 | - * OPTION2, |
|
| 75 | - * OPTION3 |
|
| 76 | - * ] |
|
| 77 | - * ], |
|
| 78 | - * 'navigation' => [ |
|
| 79 | - * 'icon' => 'css-class-of-the-icon', |
|
| 80 | - * 'options' => [ |
|
| 81 | - * OPTION1, |
|
| 82 | - * OPTION2, |
|
| 83 | - * OPTION3 |
|
| 84 | - * ] |
|
| 85 | - * ] |
|
| 86 | - * ] |
|
| 87 | - * |
|
| 88 | - * - PANEL contains entries that will be displayed in the app itself, when |
|
| 89 | - * a search is initiated. |
|
| 90 | - * - NAVIGATION contains entries that will be available when using the |
|
| 91 | - * FullTextSearch navigation page |
|
| 92 | - * - OPTION is an element that define each option available to the user. |
|
| 93 | - * |
|
| 94 | - * The format for the options must be like this: |
|
| 95 | - * |
|
| 96 | - * [ |
|
| 97 | - * 'name' => 'name_of_the_option', |
|
| 98 | - * 'title' => 'Name displayed in the panel', |
|
| 99 | - * 'type' => '', |
|
| 100 | - * 'size' => '' (optional), |
|
| 101 | - * 'placeholder' => '' (optional) |
|
| 102 | - * ] |
|
| 103 | - * |
|
| 104 | - * - NAME is the variable name that is sent to the IFullTextSearchProvider |
|
| 105 | - * when a ISearchRequest is requested. (keys in the array returned by the |
|
| 106 | - * ISearchRequest->getOptions()) |
|
| 107 | - * - TYPE can be 'input' or 'checkbox' |
|
| 108 | - * - SIZE is only used in case TYPE='input', default is 'large' but can be |
|
| 109 | - * 'small' |
|
| 110 | - * - PLACEHOLDER is only used in case TYPE='input', default is empty. |
|
| 111 | - */ |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * ISearchOption constructor. |
|
| 115 | - * |
|
| 116 | - * Some value can be setduring the creation of the object. |
|
| 117 | - * |
|
| 118 | - * @since 15.0.0 |
|
| 119 | - * |
|
| 120 | - * @param string $name |
|
| 121 | - * @param string $title |
|
| 122 | - * @param string $type |
|
| 123 | - * @param string $size |
|
| 124 | - * @param string $placeholder |
|
| 125 | - */ |
|
| 126 | - public function __construct(string $name = '', string $title = '', string $type = '', string $size = '', string $placeholder = '') { |
|
| 127 | - $this->name = $name; |
|
| 128 | - $this->title = $title; |
|
| 129 | - $this->type = $type; |
|
| 130 | - $this->size = $size; |
|
| 131 | - $this->placeholder = $placeholder; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Set the name/key of the option. |
|
| 137 | - * The string should only contains alphanumerical chars and underscore. |
|
| 138 | - * The key can be retrieve when using ISearchRequest::getOption |
|
| 139 | - * |
|
| 140 | - * @see ISearchRequest::getOption |
|
| 141 | - * |
|
| 142 | - * @since 15.0.0 |
|
| 143 | - * |
|
| 144 | - * @param string $name |
|
| 145 | - * |
|
| 146 | - * @return ISearchOption |
|
| 147 | - */ |
|
| 148 | - public function setName(string $name): ISearchOption { |
|
| 149 | - $this->name = $name; |
|
| 150 | - |
|
| 151 | - return $this; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Get the name/key of the option. |
|
| 156 | - * |
|
| 157 | - * @since 15.0.0 |
|
| 158 | - * |
|
| 159 | - * @return string |
|
| 160 | - */ |
|
| 161 | - public function getName(): string { |
|
| 162 | - return $this->name; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Set the title/display name of the option. |
|
| 168 | - * |
|
| 169 | - * @since 15.0.0 |
|
| 170 | - * |
|
| 171 | - * @param string $title |
|
| 172 | - * |
|
| 173 | - * @return ISearchOption |
|
| 174 | - */ |
|
| 175 | - public function setTitle(string $title): ISearchOption { |
|
| 176 | - $this->title = $title; |
|
| 177 | - |
|
| 178 | - return $this; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Get the title of the option. |
|
| 183 | - * |
|
| 184 | - * @since 15.0.0 |
|
| 185 | - * |
|
| 186 | - * @return string |
|
| 187 | - */ |
|
| 188 | - public function getTitle(): string { |
|
| 189 | - return $this->title; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Set the type of the option. |
|
| 195 | - * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT |
|
| 196 | - * |
|
| 197 | - * @since 15.0.0 |
|
| 198 | - * |
|
| 199 | - * @param string $type |
|
| 200 | - * |
|
| 201 | - * @return ISearchOption |
|
| 202 | - */ |
|
| 203 | - public function setType(string $type): ISearchOption { |
|
| 204 | - $this->type = $type; |
|
| 205 | - |
|
| 206 | - return $this; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Get the type of the option. |
|
| 211 | - * |
|
| 212 | - * @since 15.0.0 |
|
| 213 | - * |
|
| 214 | - * @return string |
|
| 215 | - */ |
|
| 216 | - public function getType(): string { |
|
| 217 | - return $this->type; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * In case of Type is INPUT, set the size of the input field. |
|
| 223 | - * Value can be ISearchOption::INPUT_SMALL or not defined. |
|
| 224 | - * |
|
| 225 | - * @since 15.0.0 |
|
| 226 | - * |
|
| 227 | - * @param string $size |
|
| 228 | - * |
|
| 229 | - * @return ISearchOption |
|
| 230 | - */ |
|
| 231 | - public function setSize(string $size): ISearchOption { |
|
| 232 | - $this->size = $size; |
|
| 233 | - |
|
| 234 | - return $this; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * Get the size of the INPUT. |
|
| 239 | - * |
|
| 240 | - * @since 15.0.0 |
|
| 241 | - * |
|
| 242 | - * @return string |
|
| 243 | - */ |
|
| 244 | - public function getSize(): string { |
|
| 245 | - return $this->size; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * In case of Type is , set the placeholder to be displayed in the input |
|
| 251 | - * field. |
|
| 252 | - * |
|
| 253 | - * @since 15.0.0 |
|
| 254 | - * |
|
| 255 | - * @param string $placeholder |
|
| 256 | - * |
|
| 257 | - * @return ISearchOption |
|
| 258 | - */ |
|
| 259 | - public function setPlaceholder(string $placeholder): ISearchOption { |
|
| 260 | - $this->placeholder = $placeholder; |
|
| 261 | - |
|
| 262 | - return $this; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * Get the placeholder. |
|
| 267 | - * |
|
| 268 | - * @since 15.0.0 |
|
| 269 | - * |
|
| 270 | - * @return string |
|
| 271 | - */ |
|
| 272 | - public function getPlaceholder(): string { |
|
| 273 | - return $this->placeholder; |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * @since 15.0.0 |
|
| 279 | - * |
|
| 280 | - * @return array |
|
| 281 | - */ |
|
| 282 | - public function jsonSerialize(): array { |
|
| 283 | - return [ |
|
| 284 | - 'name' => $this->getName(), |
|
| 285 | - 'title' => $this->getTitle(), |
|
| 286 | - 'type' => $this->getType(), |
|
| 287 | - 'size' => $this->getSize(), |
|
| 288 | - 'placeholder' => $this->getPlaceholder() |
|
| 289 | - ]; |
|
| 290 | - } |
|
| 48 | + /** @var string */ |
|
| 49 | + private $name = ''; |
|
| 50 | + |
|
| 51 | + /** @var string */ |
|
| 52 | + private $title = ''; |
|
| 53 | + |
|
| 54 | + /** @var string */ |
|
| 55 | + private $type = ''; |
|
| 56 | + |
|
| 57 | + /** @var string */ |
|
| 58 | + private $size = ''; |
|
| 59 | + |
|
| 60 | + /** @var string */ |
|
| 61 | + private $placeholder = ''; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * * |
|
| 66 | + * |
|
| 67 | + * The array can be empty in case no search options are available. |
|
| 68 | + * The format of the array must be like this: |
|
| 69 | + * |
|
| 70 | + * [ |
|
| 71 | + * 'panel' => [ |
|
| 72 | + * 'options' => [ |
|
| 73 | + * OPTION1, |
|
| 74 | + * OPTION2, |
|
| 75 | + * OPTION3 |
|
| 76 | + * ] |
|
| 77 | + * ], |
|
| 78 | + * 'navigation' => [ |
|
| 79 | + * 'icon' => 'css-class-of-the-icon', |
|
| 80 | + * 'options' => [ |
|
| 81 | + * OPTION1, |
|
| 82 | + * OPTION2, |
|
| 83 | + * OPTION3 |
|
| 84 | + * ] |
|
| 85 | + * ] |
|
| 86 | + * ] |
|
| 87 | + * |
|
| 88 | + * - PANEL contains entries that will be displayed in the app itself, when |
|
| 89 | + * a search is initiated. |
|
| 90 | + * - NAVIGATION contains entries that will be available when using the |
|
| 91 | + * FullTextSearch navigation page |
|
| 92 | + * - OPTION is an element that define each option available to the user. |
|
| 93 | + * |
|
| 94 | + * The format for the options must be like this: |
|
| 95 | + * |
|
| 96 | + * [ |
|
| 97 | + * 'name' => 'name_of_the_option', |
|
| 98 | + * 'title' => 'Name displayed in the panel', |
|
| 99 | + * 'type' => '', |
|
| 100 | + * 'size' => '' (optional), |
|
| 101 | + * 'placeholder' => '' (optional) |
|
| 102 | + * ] |
|
| 103 | + * |
|
| 104 | + * - NAME is the variable name that is sent to the IFullTextSearchProvider |
|
| 105 | + * when a ISearchRequest is requested. (keys in the array returned by the |
|
| 106 | + * ISearchRequest->getOptions()) |
|
| 107 | + * - TYPE can be 'input' or 'checkbox' |
|
| 108 | + * - SIZE is only used in case TYPE='input', default is 'large' but can be |
|
| 109 | + * 'small' |
|
| 110 | + * - PLACEHOLDER is only used in case TYPE='input', default is empty. |
|
| 111 | + */ |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * ISearchOption constructor. |
|
| 115 | + * |
|
| 116 | + * Some value can be setduring the creation of the object. |
|
| 117 | + * |
|
| 118 | + * @since 15.0.0 |
|
| 119 | + * |
|
| 120 | + * @param string $name |
|
| 121 | + * @param string $title |
|
| 122 | + * @param string $type |
|
| 123 | + * @param string $size |
|
| 124 | + * @param string $placeholder |
|
| 125 | + */ |
|
| 126 | + public function __construct(string $name = '', string $title = '', string $type = '', string $size = '', string $placeholder = '') { |
|
| 127 | + $this->name = $name; |
|
| 128 | + $this->title = $title; |
|
| 129 | + $this->type = $type; |
|
| 130 | + $this->size = $size; |
|
| 131 | + $this->placeholder = $placeholder; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Set the name/key of the option. |
|
| 137 | + * The string should only contains alphanumerical chars and underscore. |
|
| 138 | + * The key can be retrieve when using ISearchRequest::getOption |
|
| 139 | + * |
|
| 140 | + * @see ISearchRequest::getOption |
|
| 141 | + * |
|
| 142 | + * @since 15.0.0 |
|
| 143 | + * |
|
| 144 | + * @param string $name |
|
| 145 | + * |
|
| 146 | + * @return ISearchOption |
|
| 147 | + */ |
|
| 148 | + public function setName(string $name): ISearchOption { |
|
| 149 | + $this->name = $name; |
|
| 150 | + |
|
| 151 | + return $this; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Get the name/key of the option. |
|
| 156 | + * |
|
| 157 | + * @since 15.0.0 |
|
| 158 | + * |
|
| 159 | + * @return string |
|
| 160 | + */ |
|
| 161 | + public function getName(): string { |
|
| 162 | + return $this->name; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Set the title/display name of the option. |
|
| 168 | + * |
|
| 169 | + * @since 15.0.0 |
|
| 170 | + * |
|
| 171 | + * @param string $title |
|
| 172 | + * |
|
| 173 | + * @return ISearchOption |
|
| 174 | + */ |
|
| 175 | + public function setTitle(string $title): ISearchOption { |
|
| 176 | + $this->title = $title; |
|
| 177 | + |
|
| 178 | + return $this; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Get the title of the option. |
|
| 183 | + * |
|
| 184 | + * @since 15.0.0 |
|
| 185 | + * |
|
| 186 | + * @return string |
|
| 187 | + */ |
|
| 188 | + public function getTitle(): string { |
|
| 189 | + return $this->title; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Set the type of the option. |
|
| 195 | + * $type can be ISearchOption::CHECKBOX or ISearchOption::INPUT |
|
| 196 | + * |
|
| 197 | + * @since 15.0.0 |
|
| 198 | + * |
|
| 199 | + * @param string $type |
|
| 200 | + * |
|
| 201 | + * @return ISearchOption |
|
| 202 | + */ |
|
| 203 | + public function setType(string $type): ISearchOption { |
|
| 204 | + $this->type = $type; |
|
| 205 | + |
|
| 206 | + return $this; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Get the type of the option. |
|
| 211 | + * |
|
| 212 | + * @since 15.0.0 |
|
| 213 | + * |
|
| 214 | + * @return string |
|
| 215 | + */ |
|
| 216 | + public function getType(): string { |
|
| 217 | + return $this->type; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * In case of Type is INPUT, set the size of the input field. |
|
| 223 | + * Value can be ISearchOption::INPUT_SMALL or not defined. |
|
| 224 | + * |
|
| 225 | + * @since 15.0.0 |
|
| 226 | + * |
|
| 227 | + * @param string $size |
|
| 228 | + * |
|
| 229 | + * @return ISearchOption |
|
| 230 | + */ |
|
| 231 | + public function setSize(string $size): ISearchOption { |
|
| 232 | + $this->size = $size; |
|
| 233 | + |
|
| 234 | + return $this; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * Get the size of the INPUT. |
|
| 239 | + * |
|
| 240 | + * @since 15.0.0 |
|
| 241 | + * |
|
| 242 | + * @return string |
|
| 243 | + */ |
|
| 244 | + public function getSize(): string { |
|
| 245 | + return $this->size; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * In case of Type is , set the placeholder to be displayed in the input |
|
| 251 | + * field. |
|
| 252 | + * |
|
| 253 | + * @since 15.0.0 |
|
| 254 | + * |
|
| 255 | + * @param string $placeholder |
|
| 256 | + * |
|
| 257 | + * @return ISearchOption |
|
| 258 | + */ |
|
| 259 | + public function setPlaceholder(string $placeholder): ISearchOption { |
|
| 260 | + $this->placeholder = $placeholder; |
|
| 261 | + |
|
| 262 | + return $this; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * Get the placeholder. |
|
| 267 | + * |
|
| 268 | + * @since 15.0.0 |
|
| 269 | + * |
|
| 270 | + * @return string |
|
| 271 | + */ |
|
| 272 | + public function getPlaceholder(): string { |
|
| 273 | + return $this->placeholder; |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * @since 15.0.0 |
|
| 279 | + * |
|
| 280 | + * @return array |
|
| 281 | + */ |
|
| 282 | + public function jsonSerialize(): array { |
|
| 283 | + return [ |
|
| 284 | + 'name' => $this->getName(), |
|
| 285 | + 'title' => $this->getTitle(), |
|
| 286 | + 'type' => $this->getType(), |
|
| 287 | + 'size' => $this->getSize(), |
|
| 288 | + 'placeholder' => $this->getPlaceholder() |
|
| 289 | + ]; |
|
| 290 | + } |
|
| 291 | 291 | } |