lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sven Almgren (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-2152) Apply "filters" to mlt queries without using filters.
Date Tue, 12 Oct 2010 13:30:32 GMT

    [ 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


Mime
View raw message