Skip to content

Commit

Permalink
Make lower limit of snippet length more relaxed.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Apr 5, 2024
1 parent 1dcef3d commit 58127db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/S2/Rose/Entity/Metadata/SentenceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private function buildWordsInfo(): void
}
$newSize = $wordsInSentence + $oldSize;

if ($wordsInSentence >= 3) { // Skip too short snippets
if ($wordsInSentence >= 2) { // Skip too short snippets
$this->cachedSnippetSources[$idx] = new SnippetSource($sentence, $this->formatId, $oldSize, $newSize - 1);
}

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/Rose/SnippetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ public function testSnippets(array $indexables)
'<span class="highlight">Одна из</span> часто указываемых <span class="highlight">ошибок в веб-дизайне</span>:',
$resultSet->getItems()[0]->getFormattedSnippet()
);

$resultSet = $this->finder->find(new Query('fastcgi_cache_lock_age'));
$this->assertEquals(
'<span class="highlight">fastcgi_cache_lock_age</span> 9s;',
$resultSet->getItems()[0]->getFormattedSnippet()
);
}

public function indexableProvider()
Expand Down Expand Up @@ -246,6 +252,13 @@ public function indexableProvider()
<blockquote>А это цитата, ее тоже надо индексировать.</blockquote>
<pre><code>fastcgi_cache i_upmath;
fastcgi_cache_valid 200 10m;
fastcgi_cache_methods GET HEAD;
fastcgi_cache_lock on;
fastcgi_cache_lock_age 9s;
fastcgi_cache_lock_timeout 9s;</code></pre>
<img src="3.jpg" width="300" height="200">
<p>Ошибка <i>астатически</i> даёт более простую систему дифференциальных уравнений, если исключить небольшой угол тангажа. Если пренебречь малыми величинами, то видно, что механическая природа устойчиво требует большего внимания к анализу ошибок, которые даёт устойчивый маховик. Исходя из уравнения Эйлера, прибор вертикально позволяет пренебречь колебаниями корпуса, хотя этого в любом случае требует поплавковый ньютонометр.</p>
Expand Down

0 comments on commit 58127db

Please sign in to comment.