MoreLikeThis ignores queries?

Hi,

I am trying to filter moreLikeThis results by adding additional query - but
it seems to ignore it at all.

I tried to run my ignoreQuery separately and it works fine, but how to make
it work with moreLikeThis? Please help me.

$ignoreQuery = $this->IgnoreCategoryQuery('movies')

$this->resultsSet = $this->index->moreLikeThis(
new \Elastica\Document($id),
array_merge($this->mlt_fields, array('search_size' => $this->size
, 'search_from' => $this->from)),
$ignoreQuery);

My IgnoreCategory function:

public function IgnoreCategoryQuery($category = 'main')
{
$categoriesTermQuery = new \Elastica\Query\Term();
$categoriesTermQuery->setTerm('categories', $category);

$categoriesBoolQuery = new \Elastica\Query\Bool();
$categoriesBoolQuery->addMustNot($categoriesTermQuery);

return $categoriesBoolQuery;
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1480e498-f21c-4bc2-b43c-3d068c73ba55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anyone can help me? It really does not work...

среда, 19 марта 2014 г., 2:05:49 UTC+7 пользователь Alexey Bagryancev
написал:

Hi,

I am trying to filter moreLikeThis results by adding additional query -
but it seems to ignore it at all.

I tried to run my ignoreQuery separately and it works fine, but how to
make it work with moreLikeThis? Please help me.

$ignoreQuery = $this->IgnoreCategoryQuery('movies')

$this->resultsSet = $this->index->moreLikeThis(
new \Elastica\Document($id),
array_merge($this->mlt_fields, array('search_size' => $this->
size, 'search_from' => $this->from)),
$ignoreQuery);

My IgnoreCategory function:

public function IgnoreCategoryQuery($category = 'main')
{
$categoriesTermQuery = new \Elastica\Query\Term();
$categoriesTermQuery->setTerm('categories', $category);

$categoriesBoolQuery = new \Elastica\Query\Bool();
$categoriesBoolQuery->addMustNot($categoriesTermQuery);

return $categoriesBoolQuery;
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/212ca5d9-4c48-476d-9ea1-983b9578e8f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Alexey,

You should use the query DSL and not the more like this API. You can create
a boolean query where one clause is your more like this query and the other
one is your ignore category query (better use a filter here if you can).

However, more like this of the DSL only takes a like_text parameter, you
cannot pass the id of the document. This will change in a subsequent
version of ES. For now, to simulate this functionality, you can use
multiple mlt queries with a like_text set to the value of each field of the
queried document, inside a boolean query. Let me know if this helps.

Alex

On Wednesday, March 19, 2014 5:01:06 AM UTC+1, Alexey Bagryancev wrote:

Anyone can help me? It really does not work...

среда, 19 марта 2014 г., 2:05:49 UTC+7 пользователь Alexey Bagryancev
написал:

Hi,

I am trying to filter moreLikeThis results by adding additional query -
but it seems to ignore it at all.

I tried to run my ignoreQuery separately and it works fine, but how to
make it work with moreLikeThis? Please help me.

$ignoreQuery = $this->IgnoreCategoryQuery('movies')

$this->resultsSet = $this->index->moreLikeThis(
new \Elastica\Document($id),
array_merge($this->mlt_fields, array('search_size' => $this->
size, 'search_from' => $this->from)),
$ignoreQuery);

My IgnoreCategory function:

public function IgnoreCategoryQuery($category = 'main')
{
$categoriesTermQuery = new \Elastica\Query\Term();
$categoriesTermQuery->setTerm('categories', $category);

$categoriesBoolQuery = new \Elastica\Query\Bool();
$categoriesBoolQuery->addMustNot($categoriesTermQuery);

return $categoriesBoolQuery;
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e605d6e2-b42b-4661-b819-90735a9581ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.