Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+49 -5
View File
@@ -39,7 +39,7 @@ abstract class _Index extends \IPS\Patterns\Singleton
{
if ( \IPS\Settings::i()->search_method == 'elastic' )
{
static::$instance = new \IPS\Content\Search\Elastic\Index( \IPS\Http\Url::external( \IPS\Settings::i()->search_elastic_server . '/' . \IPS\Settings::i()->search_elastic_index ) );
static::$instance = new \IPS\Content\Search\Elastic\Index( \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->search_elastic_server, '/' ) . '/' . \IPS\Settings::i()->search_elastic_index ) );
}
else
{
@@ -59,7 +59,7 @@ abstract class _Index extends \IPS\Patterns\Singleton
{
if ( \IPS\Settings::i()->search_method == 'elastic' )
{
return new \IPS\Content\Search\Elastic\MassIndexer( \IPS\Http\Url::external( \IPS\Settings::i()->search_elastic_server . '/' . \IPS\Settings::i()->search_elastic_index ) );
return new \IPS\Content\Search\Elastic\MassIndexer( \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->search_elastic_server, '/' ) . '/' . \IPS\Settings::i()->search_elastic_index ) );
}
else
{
@@ -104,6 +104,30 @@ abstract class _Index extends \IPS\Patterns\Singleton
}
}
/**
* Index a single items comments and reviews if applicable.
*
* @param \IPS\Content\Searchable $object The item to index
* @return void
*/
public function indexSingleItem( \IPS\Content\Searchable $object )
{
try
{
$idColumn = $object::$databaseColumnId;
if ( isset( $object::$commentClass ) AND is_subclass_of( $object::$commentClass, 'IPS\Content\Searchable' ) )
{
\IPS\Task::queue( 'core', 'IndexSingleItem', array( 'class' => $object::$commentClass, 'id' => $object->$idColumn, 'title' => $object->mapped('title'), 'url' => (string) $object->url() ), 5, TRUE );
}
if ( isset( $object::$reviewClass ) AND is_subclass_of( $object::$reviewClass, 'IPS\Content\Searchable' ) )
{
\IPS\Task::queue( 'core', 'IndexSingleItem', array( 'class' => $object::$reviewClass, 'id' => $object->$idColumn, 'title' => $object->mapped('title'), 'url' => (string) $object->url() ), 5, TRUE );
}
}
catch( \OutOfRangeException $e ) {}
}
/**
* Get index data
*
@@ -138,9 +162,19 @@ abstract class _Index extends \IPS\Patterns\Singleton
$itemClass = $class::$itemClass;
if ( $itemClass::$firstCommentRequired and $object->isFirst() )
{
$title = $object->item()->searchIndexTitle();
$tags = ( $object->item() instanceof \IPS\Content\Tags and \IPS\Settings::i()->tags_enabled ) ? implode( ',', array_filter( $object->item()->tags() ) ) : NULL;
$prefix = ( $object->item() instanceof \IPS\Content\Tags and \IPS\Settings::i()->tags_enabled ) ? $object->item()->prefix() : NULL;
try
{
$item = $object->item();
}
catch( \OutOfRangeException $ex )
{
/* Comment has no working item, return */
return NULL;
}
$title = $item->searchIndexTitle();
$tags = ( $item instanceof \IPS\Content\Tags and \IPS\Settings::i()->tags_enabled ) ? implode( ',', array_filter( $item->tags() ) ) : NULL;
$prefix = ( $item instanceof \IPS\Content\Tags and \IPS\Settings::i()->tags_enabled ) ? $item->prefix() : NULL;
$isForItem = TRUE;
}
}
@@ -375,6 +409,16 @@ abstract class _Index extends \IPS\Patterns\Singleton
{
// Do nothing by default
}
/**
* Clear out any tasks associated with the search index method
*
* @return void
*/
public function clearTasks()
{
// Do nothing by default
}
/**
* Retrieve the search ID for an item