Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MoreLikeThis::setLike() allowing Document #2091

Merged
merged 2 commits into from
Jun 27, 2022

Conversation

franmomu
Copy link
Contributor

MoreLikeThis::setLike() allows Document as showed in

$doc = $index->getDocument(1);
// Return all similar from id
$mltQuery = new MoreLikeThis();
$mltQuery->setMinTermFrequency(1);
$mltQuery->setMinDocFrequency(1);
$mltQuery->setLike($doc);

$str = \md5(\mt_rand());
$str = uniqid();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is because \md5() expects a string and \mt_rand() returns an int. The return value of \mt_rand() could also be casted to string, but instead I've used uniqid(), if cast is preferred, let me know.

@franmomu franmomu force-pushed the more_like_this_doc branch from 8961e4b to 84e52a0 Compare June 24, 2022 18:33
@ruflin ruflin merged commit ae21282 into ruflin:master Jun 27, 2022
@franmomu franmomu deleted the more_like_this_doc branch June 27, 2022 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants