Commit b8fa14c32fb53380c5f3cb2cb897b92f206dac6b
1 parent
d7188644
KTS-1399
"Searching in discussion threads yields no results" Fixed. Committed By: Conrad Vermeulen Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8122 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
56 additions
and
21 deletions
search2/indexing/indexerCore.inc.php
| @@ -110,7 +110,7 @@ class QueryResultItem | @@ -110,7 +110,7 @@ class QueryResultItem | ||
| 110 | dcv.minor_version, dcv.filename, cou.name as checkoutuser, w.human_name as workflow, ws.human_name as workflowstate, | 110 | dcv.minor_version, dcv.filename, cou.name as checkoutuser, w.human_name as workflow, ws.human_name as workflowstate, |
| 111 | mt.mimetypes as mimetype, md.mime_doc as mimedoc, d.checkedout, mbu.name as modifiedbyuser, d.modified, | 111 | mt.mimetypes as mimetype, md.mime_doc as mimedoc, d.checkedout, mbu.name as modifiedbyuser, d.modified, |
| 112 | cbu.name as createdbyuser, ou.name as owneruser, d.immutable, d.status_id, d.created,dcv.storage_path, dtl.name as document_type, | 112 | cbu.name as createdbyuser, ou.name as owneruser, d.immutable, d.status_id, d.created,dcv.storage_path, dtl.name as document_type, |
| 113 | - mt.icon_path as mime_icon_path, mt.friendly_name as mime_display, d.oem_no | 113 | + mt.icon_path as mime_icon_path, mt.friendly_name as mime_display, d.oem_no, dmv.name as title |
| 114 | FROM | 114 | FROM |
| 115 | documents d | 115 | documents d |
| 116 | INNER JOIN document_metadata_version dmv ON d.metadata_version_id = dmv.id | 116 | INNER JOIN document_metadata_version dmv ON d.metadata_version_id = dmv.id |
| @@ -151,6 +151,7 @@ class QueryResultItem | @@ -151,6 +151,7 @@ class QueryResultItem | ||
| 151 | $this->filename=$result['filename']; | 151 | $this->filename=$result['filename']; |
| 152 | $this->filesize = KTUtil::filesizeToString($result['filesize']); | 152 | $this->filesize = KTUtil::filesizeToString($result['filesize']); |
| 153 | $this->folderId = $result['folder_id']; | 153 | $this->folderId = $result['folder_id']; |
| 154 | + $this->title = $result['title']; | ||
| 154 | 155 | ||
| 155 | $this->createdBy = $result['createdbyuser']; | 156 | $this->createdBy = $result['createdbyuser']; |
| 156 | $this->dateCreated = $result['created']; | 157 | $this->dateCreated = $result['created']; |
| @@ -510,7 +511,11 @@ abstract class Indexer | @@ -510,7 +511,11 @@ abstract class Indexer | ||
| 510 | { | 511 | { |
| 511 | $userid=$_SESSION['userID']; | 512 | $userid=$_SESSION['userID']; |
| 512 | if (empty($userid)) $userid=1; | 513 | if (empty($userid)) $userid=1; |
| 513 | - $sql = "INSERT INTO index_files(document_id, user_id, what) SELECT id, $userid, 'C' FROM documents WHERE status_id=1"; | 514 | + |
| 515 | + $sql = "DELETE FROM index_files"; | ||
| 516 | + DBUtil::runQuery($sql); | ||
| 517 | + | ||
| 518 | + $sql = "INSERT INTO index_files(document_id, user_id, what) SELECT id, $userid, 'A' FROM documents WHERE status_id=1 and id not in (select document_id from index_files)"; | ||
| 514 | DBUtil::runQuery($sql); | 519 | DBUtil::runQuery($sql); |
| 515 | } | 520 | } |
| 516 | 521 | ||
| @@ -895,7 +900,7 @@ abstract class Indexer | @@ -895,7 +900,7 @@ abstract class Indexer | ||
| 895 | 900 | ||
| 896 | Indexer::clearoutDeleted(); | 901 | Indexer::clearoutDeleted(); |
| 897 | 902 | ||
| 898 | - $date = date('Y-m-d H:j:s'); | 903 | + $date = date('Y-m-d H:i:s'); |
| 899 | // identify the indexers that must run | 904 | // identify the indexers that must run |
| 900 | // mysql specific limit! | 905 | // mysql specific limit! |
| 901 | $sql = "SELECT | 906 | $sql = "SELECT |
| @@ -959,18 +964,38 @@ abstract class Indexer | @@ -959,18 +964,38 @@ abstract class Indexer | ||
| 959 | 964 | ||
| 960 | $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Indexing docid: %d extension: '%s' mimetype: '%s' extractor: '%s'"), $docId, $extension,$mimeType,$extractorClass), 'debug'); | 965 | $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Indexing docid: %d extension: '%s' mimetype: '%s' extractor: '%s'"), $docId, $extension,$mimeType,$extractorClass), 'debug'); |
| 961 | 966 | ||
| 962 | - | ||
| 963 | if (empty($extractorClass)) | 967 | if (empty($extractorClass)) |
| 964 | { | 968 | { |
| 965 | - Indexer::unqueueDocument($docId, sprintf(_kt("No extractor for docid: %d"),$docId)); | ||
| 966 | - continue; | 969 | + /* |
| 970 | + | ||
| 971 | + if no extractor is found and we don't need to index discussions, then we can remove the item from the queue. | ||
| 972 | + | ||
| 973 | + */ | ||
| 974 | + if ($indexDiscussion) | ||
| 975 | + { | ||
| 976 | + $indexDocument = false; | ||
| 977 | + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Not indexing docid: %d content because extractor could not be resolve. Still indexing discussion."), $docId), 'info'); | ||
| 978 | + } | ||
| 979 | + else | ||
| 980 | + { | ||
| 981 | + Indexer::unqueueDocument($docId, sprintf(_kt("No extractor for docid: %d"),$docId)); | ||
| 982 | + continue; | ||
| 983 | + } | ||
| 967 | } | 984 | } |
| 985 | + else | ||
| 986 | + { | ||
| 987 | + /* | ||
| 968 | 988 | ||
| 969 | - if (!$this->isExtractorEnabled($extractorClass)) | ||
| 970 | - { | ||
| 971 | - $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("diagnose: Not indexing docid: %d because extractor '%s' is disabled."), $docId, $extractorClass), 'info'); | ||
| 972 | - continue; | ||
| 973 | - } | 989 | + If an extractor is available, we must ensure it is enabled. |
| 990 | + | ||
| 991 | + */ | ||
| 992 | + | ||
| 993 | + if (!$this->isExtractorEnabled($extractorClass)) | ||
| 994 | + { | ||
| 995 | + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("diagnose: Not indexing docid: %d because extractor '%s' is disabled."), $docId, $extractorClass), 'info'); | ||
| 996 | + continue; | ||
| 997 | + } | ||
| 998 | + } | ||
| 974 | 999 | ||
| 975 | if ($this->debug) | 1000 | if ($this->debug) |
| 976 | { | 1001 | { |
| @@ -1048,14 +1073,21 @@ abstract class Indexer | @@ -1048,14 +1073,21 @@ abstract class Indexer | ||
| 1048 | $title = $document->getName(); | 1073 | $title = $document->getName(); |
| 1049 | if ($indexDiscussion) | 1074 | if ($indexDiscussion) |
| 1050 | { | 1075 | { |
| 1051 | - $indexStatus = $this->indexDocumentAndDiscussion($docId, $targetFile, $title, $version); | ||
| 1052 | - $removeFromQueue = $indexStatus; | ||
| 1053 | - if (!$indexStatus) | 1076 | + if (!$this->filterText($targetFile)) |
| 1054 | { | 1077 | { |
| 1055 | - $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem indexing document %d - indexDocumentAndDiscussion"),$docId), 'error'); | 1078 | + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem filtering document %d"),$docId), 'error'); |
| 1056 | } | 1079 | } |
| 1080 | + else | ||
| 1081 | + { | ||
| 1082 | + $indexStatus = $this->indexDocumentAndDiscussion($docId, $targetFile, $title, $version); | ||
| 1083 | + $removeFromQueue = $indexStatus; | ||
| 1084 | + if (!$indexStatus) | ||
| 1085 | + { | ||
| 1086 | + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem indexing document %d - indexDocumentAndDiscussion"),$docId), 'error'); | ||
| 1087 | + } | ||
| 1057 | 1088 | ||
| 1058 | - $extractor->setIndexingStatus($indexStatus); | 1089 | + $extractor->setIndexingStatus($indexStatus); |
| 1090 | + } | ||
| 1059 | } | 1091 | } |
| 1060 | else | 1092 | else |
| 1061 | { | 1093 | { |
| @@ -1101,7 +1133,8 @@ abstract class Indexer | @@ -1101,7 +1133,8 @@ abstract class Indexer | ||
| 1101 | } | 1133 | } |
| 1102 | else | 1134 | else |
| 1103 | { | 1135 | { |
| 1104 | - $this->indexDiscussion($docId); | 1136 | + $indexStatus = $this->indexDiscussion($docId); |
| 1137 | + $removeFromQueue = $indexStatus; | ||
| 1105 | } | 1138 | } |
| 1106 | 1139 | ||
| 1107 | if ($removeFromQueue) | 1140 | if ($removeFromQueue) |
search2/search/expr.inc.php
| @@ -882,11 +882,11 @@ class TextQueryBuilder implements QueryBuilder | @@ -882,11 +882,11 @@ class TextQueryBuilder implements QueryBuilder | ||
| 882 | 882 | ||
| 883 | if (strpos($value, ' ') === false) | 883 | if (strpos($value, ' ') === false) |
| 884 | { | 884 | { |
| 885 | - $query = "$not$fieldname: $value"; | 885 | + $query = "$not$fieldname:$value"; |
| 886 | } | 886 | } |
| 887 | else | 887 | else |
| 888 | { | 888 | { |
| 889 | - $query = "$not$fieldname: \"$value\""; | 889 | + $query = "$not$fieldname:\"$value\""; |
| 890 | } | 890 | } |
| 891 | } | 891 | } |
| 892 | 892 | ||
| @@ -912,9 +912,9 @@ class TextQueryBuilder implements QueryBuilder | @@ -912,9 +912,9 @@ class TextQueryBuilder implements QueryBuilder | ||
| 912 | $not = $expr->not()?' NOT ':''; | 912 | $not = $expr->not()?' NOT ':''; |
| 913 | 913 | ||
| 914 | if (strpos($value, ' ') !== false) | 914 | if (strpos($value, ' ') !== false) |
| 915 | - $query .= "$not$fieldname: \"$value\""; | 915 | + $query .= "$not$fieldname:\"$value\""; |
| 916 | else | 916 | else |
| 917 | - $query .= "$not$fieldname: $value"; | 917 | + $query .= "$not$fieldname:$value"; |
| 918 | } | 918 | } |
| 919 | 919 | ||
| 920 | return $query; | 920 | return $query; |
search2/search/fields/DiscussionTextField.inc.php
| @@ -38,6 +38,8 @@ | @@ -38,6 +38,8 @@ | ||
| 38 | 38 | ||
| 39 | class DiscussionTextField extends SearchableText | 39 | class DiscussionTextField extends SearchableText |
| 40 | { | 40 | { |
| 41 | + public $general_op = ExprOp::CONTAINS; | ||
| 42 | + | ||
| 41 | public function __construct() | 43 | public function __construct() |
| 42 | { | 44 | { |
| 43 | parent::__construct('Discussion', _kt('Discussion Text')); | 45 | parent::__construct('Discussion', _kt('Discussion Text')); |