Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Other Methods of FREE Advertising > Online Classifieds Directory

Online Classifieds Directory Online Classifieds are an often over looked method of FREE Advertising and way of getting your brand name out there, but just ask around...they work, if you work them.

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-29-2011, 12:38 AM   #1
9i5p6m5x3j6f
Commander In Chief
 
Join Date: Sep 2010
Posts: 929
9i5p6m5x3j6f is on a distinguished road
Default

| Back to logs list

10013702 2009 年 03 月 17 日 21:22 Reading (loading. ..) Comments (0) Category: Personal Diary
in Lucene.net implement custom sorting,monster beats headphones, two Lucene.Net.Search need to implement two interfaces:


public interface SortComparatorSource
{
ScoreDocComparator NewComparator (IndexReader reader , System.String fieldname);
}

public interface ScoreDocComparator
{
int Compare (ScoreDoc i, ScoreDoc j);
System. IComparable SortValue (ScoreDoc i);
int SortType ();
}



relates to a class:


public class ScoreDoc
{
public float score;
public int doc;
public ScoreDoc (int doc,monster in-ear headphones, float score)
{
this.doc = doc;
this.score = score;
}
}


Lucene.net 2.0 contains SortType are:
defined in the Lucene.Net.Search.SortField:



public class SortField
{
public const int SCORE = 0; / / relevance
public const int DOC = 1; ; / / text block No.
public const int AUTO = 2; / / Automatic Identification
public const int STRING = 3; / / char
public const int INT = 4; / / int
public const int FLOAT = 5; / / float
; public const int CUSTOM = 9; / / custom
..
}


less DateTime, DateTime types would be to achieve a custom sort to test under :



Lucene.Net.Search.ScoreDocComparator interface implementation class:
public class DateDocComparator: Lucene.Net.Search.ScoreDocComparator
{
private string fieldname = null;
; private System.IComparable [] cachedValues;

public DateDocComparator (System.IComparable [] cachedValues,dr dre headphones, string fieldname)
; {
this.cachedValues = cachedValues;
this.fieldname = string.Intern (fieldname);
}

public int Compare (ScoreDoc i, ScoreDoc j)
{
return this.cachedValues.CompareTo (this.cachedValues [j.doc ]);
}

public System.IComparable SortValue (ScoreDoc i)
{
; return this.cachedValues;
}

public int SortType ()
{
return Lucene.Net.Search.SortField.CUSTOM;
}
}



Lucene.Net.Search.SortComparatorSource interface implementation class:


public class DateSortComparatorSource: Lucene.Net.Search.SortComparatorSource
{
public ScoreDocComparator NewComparator (Lucene.Net.Index.IndexReader reader, System.String field)
; {
return new DateDocComparator (GetCustom (reader,beats by dre studio, field), field);
}

protected virtual System.IComparable [] GetCustom (Lucene. Net.Index.IndexReader reader, System.String field)
{
; System.IComparable [] retArray = new System.IComparable [reader.MaxDoc ()];
; Lucene.Net.Index.TermDocs termDocs = reader.TermDocs ();
; Lucene.Net.Index.TermEnum termEnum = reader.Terms (new Lucene.Net.Index.Term (field, \);
try
; {
; do
; {
; Lucene.Net.Index.Term term = termEnum.Term ();
; if (term == null | | term.Field (),beats headphones! = field)
; ; break;
System.IComparable termval = Lucene.Net.Documents.DateTools.StringToDate (term.Text ());
; termDocs.Seek (termEnum);
; while (termDocs.Next ())
{
retArray [termDocs.Doc ()] = termval;
}
}
while (termEnum.Next ());
}
finally
{
termDocs.Close ();
; termEnum.Close ();
}
return retArray;
}
}




use:


Sort sort = new Sort (new SortField (\
9i5p6m5x3j6f is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 01:24 AM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum