You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Sven Almgren (JIRA)" <ji...@apache.org> on 2010/10/12 15:30:32 UTC

[jira] Commented: (SOLR-2152) Apply "filters" to mlt queries without using filters.

    [ https://issues.apache.org/jira/browse/SOLR-2152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920184#action_12920184 ] 

Sven Almgren commented on SOLR-2152:
------------------------------------

The idea is to inject the additional query around the PriorityQueue created by the MoreLikeThis class. MLT query is basically a big OR'ed query from "interesting terms", and we want to add requirements to this query.

My solution would be to wrap the result from MoreLikeThis.like() with this "constraints query", like how the original document is excluded from the result.

Change

{code} 
// exclude current document from results
BooleanQuery mltQuery = new BooleanQuery();
mltQuery.add(mltquery, BooleanClause.Occur.MUST);
mltQuery.add(
    new TermQuery(new Term(uniqueKeyField.getName(), uniqueKeyField.getType().storedToIndexed(doc.getFieldable(uniqueKeyField.getName())))), 
        BooleanClause.Occur.MUST_NOT);
{code}

into something like

{code} 
BooleanQuery constraint = GetThisQueryFrom("mlt.constraint");
// exclude current document from results
BooleanQuery mltQuery = new BooleanQuery();
mltQuery.add(mltquery, BooleanClause.Occur.MUST);
mltQuery.add(constraint, BooleanClause.Occur.MUST);
mltQuery.add(
    new TermQuery(new Term(uniqueKeyField.getName(), uniqueKeyField.getType().storedToIndexed(doc.getFieldable(uniqueKeyField.getName())))), 
        BooleanClause.Occur.MUST_NOT);
{code} 


> Apply "filters" to mlt queries without using filters.
> -----------------------------------------------------
>
>                 Key: SOLR-2152
>                 URL: https://issues.apache.org/jira/browse/SOLR-2152
>             Project: Solr
>          Issue Type: New Feature
>          Components: MoreLikeThis
>            Reporter: Sven Almgren
>
> We need to provide some additional constraints on the results from MoreLikeThis but would prefer not to trash our caches with short lived filters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org