Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -26,7 +26,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
* @brief Elasticsearch version requirements
|
||||
*/
|
||||
const MINIMUM_VERSION = '6.0.0';
|
||||
const UNSUPPORTED_VERSION = '8.0.0';
|
||||
const UNSUPPORTED_VERSION = '7.7.0';
|
||||
|
||||
/**
|
||||
* @brief The server URL
|
||||
@@ -212,7 +212,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
|
||||
if( $error = $this->getResponseError( $r ) )
|
||||
{
|
||||
throw new \IPS\Content\Search\Elastic\Exception( $error['type'] . ' ' . $error['type'] );
|
||||
throw new \IPS\Content\Search\Elastic\Exception( $error['type'] . ': ' . $error['reason'] );
|
||||
}
|
||||
|
||||
/* Views / Comments / Reviews */
|
||||
@@ -910,7 +910,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
$item = $itemClass::load( $indexItemId );
|
||||
|
||||
$where = NULL;
|
||||
if( $ignoreId !== NULL )
|
||||
if( $ignoreId !== NULL AND isset( $itemClass::$commentClass ) )
|
||||
{
|
||||
$commentClass = $itemClass::$commentClass;
|
||||
$commentIdColumn = $commentClass::$databaseColumnId;
|
||||
|
||||
@@ -411,8 +411,8 @@ abstract class _Index extends \IPS\Patterns\Singleton
|
||||
'index_item_author' => \intval( ( $object instanceof \IPS\Content\Item ) ? $object->mapped('author') : $object->item()->mapped('author') ),
|
||||
'index_is_last_comment' => $isLastComment,
|
||||
'index_club_id' => $clubId,
|
||||
'index_class_type_id_hash' => md5( $class . ':' . $object->$idColumn )
|
||||
|
||||
'index_class_type_id_hash' => md5( $class . ':' . $object->$idColumn ),
|
||||
'index_is_anon' => $object->isAnonymous()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 0 ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=?', $indexData['index_item_id'] ) );
|
||||
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 0 ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? AND index_is_last_comment=1', $indexData['index_item_id'] ) );
|
||||
}
|
||||
|
||||
if ( $existingData !== NULL and ( $indexData['index_class'] == $existingData['index_class'] and $indexData['index_object_id'] == $existingData['index_object_id'] ) )
|
||||
@@ -589,7 +589,7 @@ class _Index extends \IPS\Content\Search\Index
|
||||
*/
|
||||
public function resetLastComment( $classes, $indexItemId, $ignoreId = NULL )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 0 ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=?', $indexItemId ) );
|
||||
\IPS\Db::i()->update( 'core_search_index', array( 'index_is_last_comment' => 0 ), array( \IPS\Db::i()->in( 'index_class', $classes ) . ' AND index_item_id=? AND index_is_last_comment=1', $indexItemId ) );
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -78,6 +78,11 @@ class _Query extends \IPS\Content\Search\Query
|
||||
* @see filterByUnread()
|
||||
*/
|
||||
protected $filterByUnread = FALSE;
|
||||
|
||||
/**
|
||||
* @brief InnoDb Stop words
|
||||
*/
|
||||
protected static $innoDBStopWords = array( 'a','about','an','are','as','at','be','by','com','de','en','for','from','how','i','in','is','it','la','of','on','or','that','the','this','to','was','what','when','where','who','will','with','und','the','www' );
|
||||
|
||||
/**
|
||||
* Filter by multiple content types
|
||||
@@ -692,7 +697,7 @@ class _Query extends \IPS\Content\Search\Query
|
||||
{
|
||||
/* Avoid packet issues */
|
||||
krsort( $markers );
|
||||
$useIds = array_flip( \array_slice( $markers, 0, 500, TRUE ) );
|
||||
$useIds = array_flip( \array_slice( $markers, 0, 1000, TRUE ) );
|
||||
$select = '';
|
||||
$from = '';
|
||||
$notIn = array();
|
||||
@@ -1096,7 +1101,8 @@ class _Query extends \IPS\Content\Search\Query
|
||||
/* Operators are not allowed */
|
||||
$word = preg_replace( '/[+\-><\(\)~*\"@%]+/', '', $word );
|
||||
|
||||
if ( $word )
|
||||
/* If any words are stop words the lookup will fail */
|
||||
if ( $word and !\in_array( $word, static::$innoDBStopWords ) )
|
||||
{
|
||||
$words[] = $word;
|
||||
}
|
||||
@@ -1250,10 +1256,15 @@ class _Query extends \IPS\Content\Search\Query
|
||||
$order = $this->order;
|
||||
|
||||
/* This forces MySQL to strongly hint a better index to the optimiser for MySQL 5.7+, even though sorting will not be affected */
|
||||
if ( $this->filterByUnread and ( ! mb_stristr( \IPS\Db::i()->server_info, '-MariaDB' ) and \IPS\Db::i()->server_version >= 50700 ) )
|
||||
if ( $this->filterByUnread !== FALSE and ( ! mb_stristr( \IPS\Db::i()->server_info, '-MariaDB' ) and \IPS\Db::i()->server_version >= 50700 ) )
|
||||
{
|
||||
$order .= ", index_date_updated";
|
||||
}
|
||||
|
||||
if( $this->filterByUnread === TRUE )
|
||||
{
|
||||
$this->forceIndex = 'index_date_updated';
|
||||
}
|
||||
|
||||
/* But we're sorting by relevancy, we need to actually select that value with our fancy algorithm */
|
||||
if ( mb_substr( $this->order, 0, 9 ) === 'calcscore' )
|
||||
@@ -1452,4 +1463,4 @@ class _Query extends \IPS\Content\Search\Query
|
||||
/* And then pass up */
|
||||
return parent::termAsWordsArray( $term, $ignorePhrase, $minLength, $maxLength );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class _Content extends \IPS\Content\Search\Result
|
||||
* @param array $reactions Reaction Data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating = NULL, $iPostedIn = FALSE, $reactions=array() )
|
||||
public function __construct( array $indexData, array $authorData, array $itemData, ?array $containerData, array $reputationData, $reviewRating = NULL, $iPostedIn = FALSE, $reactions=array() )
|
||||
{
|
||||
$this->createdDate = \IPS\DateTime::ts( $indexData['index_date_created'] );
|
||||
$this->lastUpdatedDate = \IPS\DateTime::ts( $indexData['index_date_updated'] );
|
||||
|
||||
@@ -36,9 +36,6 @@ abstract class _Result
|
||||
with one of the alternative Emoji style images though because that re-introduces images, so we
|
||||
just strip them out (making them behave like emoticons) */
|
||||
|
||||
/* Trim content down to a sensible length for display */
|
||||
$content = mb_substr( $content, 0, 600 );
|
||||
|
||||
if ( \IPS\Settings::i()->emoji_style == 'twemoji' )
|
||||
{
|
||||
return preg_replace( '/(?:' . \IPS\Text\Parser::EMOJI_REGEX . '|\x{200d})+/u', '', $content );
|
||||
|
||||
Reference in new issue
Block a user