You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Ryan McKinley (JIRA)" <ji...@apache.org> on 2010/01/04 05:46:56 UTC

[jira] Updated: (SOLR-1694) DocFrequencyValueSource

     [ https://issues.apache.org/jira/browse/SOLR-1694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley updated SOLR-1694:
--------------------------------

    Attachment: SOLR-1694-DocFrequencyValueSource.patch

This is a first draft, it gets the DF with:
{code:java}
public DocValues getValues(Map context, final IndexReader reader) throws IOException 
  {
    final String[] arr = cache.getStrings(reader, field);
    return new DocValues() {

      public int intVal(int doc) 
      {
        try {
          int v = reader.docFreq( new Term( qfield, arr[doc] ) ); 
          //System.out.println( "DF("+arr[doc]+":"+v );
          return v;
        } 
        catch (IOException e) {
          e.printStackTrace();
        }
        return 0;
      }
{code}

You call the function with:
{code}
 http://localhost:3456/solr/select?q=*:*&sort=df(id,links) desc
{code}

NOTE: right now this only works with string fields




> DocFrequencyValueSource
> -----------------------
>
>                 Key: SOLR-1694
>                 URL: https://issues.apache.org/jira/browse/SOLR-1694
>             Project: Solr
>          Issue Type: New Feature
>          Components: search
>            Reporter: Ryan McKinley
>            Priority: Minor
>         Attachments: SOLR-1694-DocFrequencyValueSource.patch
>
>
> A ValueSource to expose the document frequency for a given field.

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