IndexDocument.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018
  5. *
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OC\FullTextSearch\Model;
  25. use JsonSerializable;
  26. use OCP\FullTextSearch\Model\IDocumentAccess;
  27. use OCP\FullTextSearch\Model\IIndex;
  28. use OCP\FullTextSearch\Model\IIndexDocument;
  29. /**
  30. * Class IndexDocument
  31. *
  32. * This is one of the main class of the FullTextSearch, used as a data transfer
  33. * object. An IndexDocument is created to manage documents around FullTextSearch,
  34. * during an index and during a search.
  35. * The uniqueness of an IndexDocument is made by the Id of the Content Provider
  36. * and the Id of the original document within the Content Provider.
  37. *
  38. * We will call original document the source from which the IndexDocument is
  39. * generated. As an example, an original document can be a file, a mail, ...
  40. *
  41. * @since 15.0.0
  42. *
  43. * @package OC\FullTextSearch\Model
  44. */
  45. class IndexDocument implements IIndexDocument, JsonSerializable {
  46. /** @var string */
  47. protected $id = '';
  48. /** @var string */
  49. protected $providerId = '';
  50. /** @var DocumentAccess */
  51. protected $access;
  52. /** @var IIndex */
  53. protected $index;
  54. /** @var int */
  55. protected $modifiedTime = 0;
  56. /** @var string */
  57. protected $source = '';
  58. /** @var array */
  59. protected $tags = [];
  60. /** @var array */
  61. protected $metaTags = [];
  62. /** @var array */
  63. protected $subTags = [];
  64. /** @var string */
  65. protected $title = '';
  66. /** @var string */
  67. protected $content = '';
  68. /** @var string */
  69. protected $hash = '';
  70. /** @var array */
  71. protected $parts = [];
  72. /** @var string */
  73. protected $link = '';
  74. /** @var array */
  75. protected $more = [];
  76. /** @var array */
  77. protected $excerpts = [];
  78. /** @var string */
  79. protected $score = '';
  80. /** @var array */
  81. protected $info = [];
  82. /** @var int */
  83. protected $contentEncoded = 0;
  84. /**
  85. * IIndexDocument constructor.
  86. *
  87. * On creation, we assure the uniqueness of the object using the providerId
  88. * and the Id of the original document.
  89. *
  90. * @since 15.0.0
  91. *
  92. * @param string $providerId
  93. * @param string $documentId
  94. */
  95. public function __construct(string $providerId, string $documentId) {
  96. $this->providerId = $providerId;
  97. $this->id = $documentId;
  98. }
  99. /**
  100. * Returns the Id of the original document.
  101. *
  102. * @since 15.0.0
  103. *
  104. * @return string
  105. */
  106. final public function getId(): string {
  107. return $this->id;
  108. }
  109. /**
  110. * Returns the Id of the provider.
  111. *
  112. * @since 15.0.0
  113. *
  114. * @return string
  115. */
  116. final public function getProviderId(): string {
  117. return $this->providerId;
  118. }
  119. /**
  120. * Set the Index related to the IIndexDocument.
  121. *
  122. * @see IIndex
  123. *
  124. * @since 15.0.0
  125. *
  126. * @param IIndex $index
  127. *
  128. * @return IIndexDocument
  129. */
  130. final public function setIndex(IIndex $index): IIndexDocument {
  131. $this->index = $index;
  132. return $this;
  133. }
  134. /**
  135. * Get the Index.
  136. *
  137. * @since 15.0.0
  138. *
  139. * @return IIndex
  140. */
  141. final public function getIndex(): IIndex {
  142. return $this->index;
  143. }
  144. /**
  145. * return if Index is defined.
  146. *
  147. * @since 16.0.0
  148. *
  149. * @return bool
  150. */
  151. final public function hasIndex(): bool {
  152. return ($this->index !== null);
  153. }
  154. /**
  155. * Set the modified time of the original document.
  156. *
  157. * @since 15.0.0
  158. *
  159. * @param int $modifiedTime
  160. *
  161. * @return IIndexDocument
  162. */
  163. final public function setModifiedTime(int $modifiedTime): IIndexDocument {
  164. $this->modifiedTime = $modifiedTime;
  165. return $this;
  166. }
  167. /**
  168. * Get the modified time of the original document.
  169. *
  170. * @since 15.0.0
  171. *
  172. * @return int
  173. */
  174. final public function getModifiedTime(): int {
  175. return $this->modifiedTime;
  176. }
  177. /**
  178. * Check if the original document of the IIndexDocument is older than $time.
  179. *
  180. * @since 15.0.0
  181. *
  182. * @param int $time
  183. *
  184. * @return bool
  185. */
  186. final public function isOlderThan(int $time): bool {
  187. return ($this->modifiedTime < $time);
  188. }
  189. /**
  190. * Set the read rights of the original document using a IDocumentAccess.
  191. *
  192. * @see IDocumentAccess
  193. *
  194. * @since 15.0.0
  195. *
  196. * @param IDocumentAccess $access
  197. *
  198. * @return $this
  199. */
  200. final public function setAccess(IDocumentAccess $access): IIndexDocument {
  201. $this->access = $access;
  202. return $this;
  203. }
  204. /**
  205. * Get the IDocumentAccess related to the original document.
  206. *
  207. * @since 15.0.0
  208. *
  209. * @return IDocumentAccess
  210. */
  211. final public function getAccess(): IDocumentAccess {
  212. return $this->access;
  213. }
  214. /**
  215. * Add a tag to the list.
  216. *
  217. * @since 15.0.0
  218. *
  219. * @param string $tag
  220. *
  221. * @return IIndexDocument
  222. */
  223. final public function addTag(string $tag): IIndexDocument {
  224. $this->tags[] = $tag;
  225. return $this;
  226. }
  227. /**
  228. * Set the list of tags assigned to the original document.
  229. *
  230. * @since 15.0.0
  231. *
  232. * @param array $tags
  233. *
  234. * @return IIndexDocument
  235. */
  236. final public function setTags(array $tags): IIndexDocument {
  237. $this->tags = $tags;
  238. return $this;
  239. }
  240. /**
  241. * Get the list of tags assigned to the original document.
  242. *
  243. * @since 15.0.0
  244. *
  245. * @return array
  246. */
  247. final public function getTags(): array {
  248. return $this->tags;
  249. }
  250. /**
  251. * Add a meta tag to the list.
  252. *
  253. * @since 15.0.0
  254. *
  255. * @param string $tag
  256. *
  257. * @return IIndexDocument
  258. */
  259. final public function addMetaTag(string $tag): IIndexDocument {
  260. $this->metaTags[] = $tag;
  261. return $this;
  262. }
  263. /**
  264. * Set the list of meta tags assigned to the original document.
  265. *
  266. * @since 15.0.0
  267. *
  268. * @param array $tags
  269. *
  270. * @return IIndexDocument
  271. */
  272. final public function setMetaTags(array $tags): IIndexDocument {
  273. $this->metaTags = $tags;
  274. return $this;
  275. }
  276. /**
  277. * Get the list of meta tags assigned to the original document.
  278. *
  279. * @since 15.0.0
  280. *
  281. * @return array
  282. */
  283. final public function getMetaTags(): array {
  284. return $this->metaTags;
  285. }
  286. /**
  287. * Add a sub tag to the list.
  288. *
  289. * @since 15.0.0
  290. *
  291. * @param string $sub
  292. * @param string $tag
  293. *
  294. * @return IIndexDocument
  295. */
  296. final public function addSubTag(string $sub, string $tag): IIndexDocument {
  297. if (!array_key_exists($sub, $this->subTags)) {
  298. $this->subTags[$sub] = [];
  299. }
  300. $this->subTags[$sub][] = $tag;
  301. return $this;
  302. }
  303. /**
  304. * Set the list of sub tags assigned to the original document.
  305. *
  306. * @since 15.0.0
  307. *
  308. * @param array $tags
  309. *
  310. * @return IIndexDocument
  311. */
  312. final public function setSubTags(array $tags): IIndexDocument {
  313. $this->subTags = $tags;
  314. return $this;
  315. }
  316. /**
  317. * Get the list of sub tags assigned to the original document.
  318. * If $formatted is true, the result will be formatted in a one
  319. * dimensional array.
  320. *
  321. * @since 15.0.0
  322. *
  323. * @param bool $formatted
  324. *
  325. * @return array
  326. */
  327. final public function getSubTags(bool $formatted = false): array {
  328. if ($formatted === false) {
  329. return $this->subTags;
  330. }
  331. $subTags = [];
  332. $ak = array_keys($this->subTags);
  333. foreach ($ak as $source) {
  334. $tags = $this->subTags[$source];
  335. foreach ($tags as $tag) {
  336. $subTags[] = $source . '_' . $tag;
  337. }
  338. }
  339. return $subTags;
  340. }
  341. /**
  342. * Set the source of the original document.
  343. *
  344. * @since 15.0.0
  345. *
  346. * @param string $source
  347. *
  348. * @return IIndexDocument
  349. */
  350. final public function setSource(string $source): IIndexDocument {
  351. $this->source = $source;
  352. return $this;
  353. }
  354. /**
  355. * Get the source of the original document.
  356. *
  357. * @since 15.0.0
  358. *
  359. * @return string
  360. */
  361. final public function getSource(): string {
  362. return $this->source;
  363. }
  364. /**
  365. * Set the title of the original document.
  366. *
  367. * @since 15.0.0
  368. *
  369. * @param string $title
  370. *
  371. * @return IIndexDocument
  372. */
  373. final public function setTitle(string $title): IIndexDocument {
  374. $this->title = $title;
  375. return $this;
  376. }
  377. /**
  378. * Get the title of the original document.
  379. *
  380. * @since 15.0.0
  381. *
  382. * @return string
  383. */
  384. final public function getTitle(): string {
  385. return $this->title;
  386. }
  387. /**
  388. * Set the content of the document.
  389. * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or
  390. * encoded in base64.
  391. *
  392. * @since 15.0.0
  393. *
  394. * @param string $content
  395. * @param int $encoded
  396. *
  397. * @return IIndexDocument
  398. */
  399. final public function setContent(string $content, int $encoded = 0): IIndexDocument {
  400. $this->content = $content;
  401. $this->contentEncoded = $encoded;
  402. return $this;
  403. }
  404. /**
  405. * Get the content of the original document.
  406. *
  407. * @since 15.0.0
  408. *
  409. * @return string
  410. */
  411. final public function getContent(): string {
  412. return $this->content;
  413. }
  414. /**
  415. * Returns the type of the encoding on the content.
  416. *
  417. * @since 15.0.0
  418. *
  419. * @return int
  420. */
  421. final public function isContentEncoded(): int {
  422. return $this->contentEncoded;
  423. }
  424. /**
  425. * Return the size of the content.
  426. *
  427. * @since 15.0.0
  428. *
  429. * @return int
  430. */
  431. final public function getContentSize(): int {
  432. return strlen($this->getContent());
  433. }
  434. /**
  435. * Generate an hash, based on the content of the original document.
  436. *
  437. * @since 15.0.0
  438. *
  439. * @return IIndexDocument
  440. */
  441. final public function initHash(): IIndexDocument {
  442. if ($this->getContent() === '' || is_null($this->getContent())) {
  443. return $this;
  444. }
  445. $this->hash = hash("md5", $this->getContent());
  446. return $this;
  447. }
  448. /**
  449. * Set the hash of the original document.
  450. *
  451. * @since 15.0.0
  452. *
  453. * @param string $hash
  454. *
  455. * @return IIndexDocument
  456. */
  457. final public function setHash(string $hash): IIndexDocument {
  458. $this->hash = $hash;
  459. return $this;
  460. }
  461. /**
  462. * Get the hash of the original document.
  463. *
  464. * @since 15.0.0
  465. *
  466. * @return string
  467. */
  468. final public function getHash(): string {
  469. return $this->hash;
  470. }
  471. /**
  472. * Add a part, identified by a string, and its content.
  473. *
  474. * It is strongly advised to use alphanumerical chars with no space in the
  475. * $part string.
  476. *
  477. * @since 15.0.0
  478. *
  479. * @param string $part
  480. * @param string $content
  481. *
  482. * @return IIndexDocument
  483. */
  484. final public function addPart(string $part, string $content): IIndexDocument {
  485. $this->parts[$part] = $content;
  486. return $this;
  487. }
  488. /**
  489. * Set all parts and their content.
  490. *
  491. * @since 15.0.0
  492. *
  493. * @param array $parts
  494. *
  495. * @return IIndexDocument
  496. */
  497. final public function setParts(array $parts): IIndexDocument {
  498. $this->parts = $parts;
  499. return $this;
  500. }
  501. /**
  502. * Get all parts of the IIndexDocument.
  503. *
  504. * @since 15.0.0
  505. *
  506. * @return array
  507. */
  508. final public function getParts(): array {
  509. return $this->parts;
  510. }
  511. /**
  512. * Add a link, usable by the frontend.
  513. *
  514. * @since 15.0.0
  515. *
  516. * @param string $link
  517. *
  518. * @return IIndexDocument
  519. */
  520. final public function setLink(string $link): IIndexDocument {
  521. $this->link = $link;
  522. return $this;
  523. }
  524. /**
  525. * Get the link.
  526. *
  527. * @since 15.0.0
  528. *
  529. * @return string
  530. */
  531. final public function getLink(): string {
  532. return $this->link;
  533. }
  534. /**
  535. * Set more information that couldn't be set using other method.
  536. *
  537. * @since 15.0.0
  538. *
  539. * @param array $more
  540. *
  541. * @return IIndexDocument
  542. */
  543. final public function setMore(array $more): IIndexDocument {
  544. $this->more = $more;
  545. return $this;
  546. }
  547. /**
  548. * Get more information.
  549. *
  550. * @since 15.0.0
  551. *
  552. * @return array
  553. */
  554. final public function getMore(): array {
  555. return $this->more;
  556. }
  557. /**
  558. * Add some excerpt of the content of the original document, usually based
  559. * on the search request.
  560. *
  561. * @since 16.0.0
  562. *
  563. * @param string $source
  564. * @param string $excerpt
  565. *
  566. * @return IIndexDocument
  567. */
  568. final public function addExcerpt(string $source, string $excerpt): IIndexDocument {
  569. $this->excerpts[] =
  570. [
  571. 'source' => $source,
  572. 'excerpt' => $this->cleanExcerpt($excerpt)
  573. ];
  574. return $this;
  575. }
  576. /**
  577. * Set all excerpts of the content of the original document.
  578. *
  579. * @since 16.0.0
  580. *
  581. * @param array $excerpts
  582. *
  583. * @return IIndexDocument
  584. */
  585. final public function setExcerpts(array $excerpts): IIndexDocument {
  586. $new = [];
  587. foreach ($excerpts as $entry) {
  588. $new[] = [
  589. 'source' => $entry['source'],
  590. 'excerpt' => $this->cleanExcerpt($entry['excerpt'])
  591. ];
  592. }
  593. $this->excerpts = $new;
  594. return $this;
  595. }
  596. /**
  597. * Get all excerpts of the content of the original document.
  598. *
  599. * @since 15.0.0
  600. *
  601. * @return array
  602. */
  603. final public function getExcerpts(): array {
  604. return $this->excerpts;
  605. }
  606. /**
  607. * Clean excerpt.
  608. *
  609. * @since 16.0.0
  610. *
  611. * @param string $excerpt
  612. * @return string
  613. */
  614. private function cleanExcerpt(string $excerpt): string {
  615. $excerpt = str_replace("\\n", ' ', $excerpt);
  616. $excerpt = str_replace("\\r", ' ', $excerpt);
  617. $excerpt = str_replace("\\t", ' ', $excerpt);
  618. $excerpt = str_replace("\n", ' ', $excerpt);
  619. $excerpt = str_replace("\r", ' ', $excerpt);
  620. $excerpt = str_replace("\t", ' ', $excerpt);
  621. return $excerpt;
  622. }
  623. /**
  624. * Set the score to the result assigned to this document during a search
  625. * request.
  626. *
  627. * @since 15.0.0
  628. *
  629. * @param string $score
  630. *
  631. * @return IIndexDocument
  632. */
  633. final public function setScore(string $score): IIndexDocument {
  634. $this->score = $score;
  635. return $this;
  636. }
  637. /**
  638. * Get the score.
  639. *
  640. * @since 15.0.0
  641. *
  642. * @return string
  643. */
  644. final public function getScore(): string {
  645. return $this->score;
  646. }
  647. /**
  648. * Set some information about the original document that will be available
  649. * to the front-end when displaying search result. (as string)
  650. * Because this information will not be indexed, this method can also be
  651. * used to manage some data while filling the IIndexDocument before its
  652. * indexing.
  653. *
  654. * @since 15.0.0
  655. *
  656. * @param string $info
  657. * @param string $value
  658. *
  659. * @return IIndexDocument
  660. */
  661. final public function setInfo(string $info, string $value): IIndexDocument {
  662. $this->info[$info] = $value;
  663. return $this;
  664. }
  665. /**
  666. * Get an information about a document. (string)
  667. *
  668. * @since 15.0.0
  669. *
  670. * @param string $info
  671. * @param string $default
  672. *
  673. * @return string
  674. */
  675. final public function getInfo(string $info, string $default = ''): string {
  676. if (!key_exists($info, $this->info)) {
  677. return $default;
  678. }
  679. return $this->info[$info];
  680. }
  681. /**
  682. * Set some information about the original document that will be available
  683. * to the front-end when displaying search result. (as array)
  684. * Because this information will not be indexed, this method can also be
  685. * used to manage some data while filling the IIndexDocument before its
  686. * indexing.
  687. *
  688. * @since 15.0.0
  689. *
  690. * @param string $info
  691. * @param array $value
  692. *
  693. * @return IIndexDocument
  694. */
  695. final public function setInfoArray(string $info, array $value): IIndexDocument {
  696. $this->info[$info] = $value;
  697. return $this;
  698. }
  699. /**
  700. * Get an information about a document. (array)
  701. *
  702. * @since 15.0.0
  703. *
  704. * @param string $info
  705. * @param array $default
  706. *
  707. * @return array
  708. */
  709. final public function getInfoArray(string $info, array $default = []): array {
  710. if (!key_exists($info, $this->info)) {
  711. return $default;
  712. }
  713. return $this->info[$info];
  714. }
  715. /**
  716. * Set some information about the original document that will be available
  717. * to the front-end when displaying search result. (as int)
  718. * Because this information will not be indexed, this method can also be
  719. * used to manage some data while filling the IIndexDocument before its
  720. * indexing.
  721. *
  722. * @since 15.0.0
  723. *
  724. * @param string $info
  725. * @param int $value
  726. *
  727. * @return IIndexDocument
  728. */
  729. final public function setInfoInt(string $info, int $value): IIndexDocument {
  730. $this->info[$info] = $value;
  731. return $this;
  732. }
  733. /**
  734. * Get an information about a document. (int)
  735. *
  736. * @since 15.0.0
  737. *
  738. * @param string $info
  739. * @param int $default
  740. *
  741. * @return int
  742. */
  743. final public function getInfoInt(string $info, int $default = 0): int {
  744. if (!key_exists($info, $this->info)) {
  745. return $default;
  746. }
  747. return $this->info[$info];
  748. }
  749. /**
  750. * Set some information about the original document that will be available
  751. * to the front-end when displaying search result. (as bool)
  752. * Because this information will not be indexed, this method can also be
  753. * used to manage some data while filling the IIndexDocument before its
  754. * indexing.
  755. *
  756. * @since 15.0.0
  757. *
  758. * @param string $info
  759. * @param bool $value
  760. *
  761. * @return IIndexDocument
  762. */
  763. final public function setInfoBool(string $info, bool $value): IIndexDocument {
  764. $this->info[$info] = $value;
  765. return $this;
  766. }
  767. /**
  768. * Get an information about a document. (bool)
  769. *
  770. * @since 15.0.0
  771. *
  772. * @param string $info
  773. * @param bool $default
  774. *
  775. * @return bool
  776. */
  777. final public function getInfoBool(string $info, bool $default = false): bool {
  778. if (!key_exists($info, $this->info)) {
  779. return $default;
  780. }
  781. return $this->info[$info];
  782. }
  783. /**
  784. * Get all info.
  785. *
  786. * @since 15.0.0
  787. *
  788. * @return array
  789. */
  790. final public function getInfoAll(): array {
  791. $info = [];
  792. foreach ($this->info as $k => $v) {
  793. if (substr($k, 0, 1) === '_') {
  794. continue;
  795. }
  796. $info[$k] = $v;
  797. }
  798. return $info;
  799. }
  800. /**
  801. * @since 15.0.0
  802. *
  803. * On some version of PHP, it is better to force destruct the object.
  804. * And during the index, the number of generated IIndexDocument can be
  805. * _huge_.
  806. */
  807. public function __destruct() {
  808. unset($this->id);
  809. unset($this->providerId);
  810. unset($this->access);
  811. unset($this->modifiedTime);
  812. unset($this->title);
  813. unset($this->content);
  814. unset($this->hash);
  815. unset($this->link);
  816. unset($this->source);
  817. unset($this->tags);
  818. unset($this->metaTags);
  819. unset($this->subTags);
  820. unset($this->more);
  821. unset($this->excerpts);
  822. unset($this->score);
  823. unset($this->info);
  824. unset($this->contentEncoded);
  825. }
  826. /**
  827. * @since 15.0.0
  828. */
  829. public function jsonSerialize(): array {
  830. return [
  831. 'id' => $this->getId(),
  832. 'providerId' => $this->getProviderId(),
  833. 'access' => $this->access,
  834. 'modifiedTime' => $this->getModifiedTime(),
  835. 'title' => $this->getTitle(),
  836. 'link' => $this->getLink(),
  837. 'index' => $this->index,
  838. 'source' => $this->getSource(),
  839. 'info' => $this->getInfoAll(),
  840. 'hash' => $this->getHash(),
  841. 'contentSize' => $this->getContentSize(),
  842. 'tags' => $this->getTags(),
  843. 'metatags' => $this->getMetaTags(),
  844. 'subtags' => $this->getSubTags(),
  845. 'more' => $this->getMore(),
  846. 'excerpts' => $this->getExcerpts(),
  847. 'score' => $this->getScore()
  848. ];
  849. }
  850. }