Mailing List Archive

Re: search bean and sorting
Hi,

I currently use the SearchBean code (although I did refactor much of the
code in the contribution) to sort by date.

Your same code should work if you created a field "formattedDate"

Again, I haven't tested this new refactored code, so let me know if you run
into any problems.

--Peter

On 6/19/02 12:19 PM, "Srinivas.Kotamraju@bmsus.com"
<Srinivas.Kotamraju@bmsus.com> wrote:

> hi carlson,
> i have seen your code contribution in the lucene sand box. I thank you for
> sharing it will all other developers.I am thinking of using it, but I am
> wondering If the sorting mechanism for a field you have implemented would
> also work for Dates? please let me know.
> I have a bunch of html files with metags like <META NAME="ISSUE_DATE"
> CONTENT="3/25/2002">
> and I am parsing the files and adding the dates using the DateField to my
> index..
>
> doc.add(Field.Keyword("date",DateField.dateToString(formattedDate)));
>
> I want the hits returned, to be sorted by date? would a call to ur
> code..like below..give me the results sorted by date?
> thanks in advance.
> srini
> SearchBean sb = new SearchBean(index,formattedDate);
> HitsIterator hi = sb.search("metal");
> while (hi.hasNext())
> { Document doc = hi.next(); }
>
>
>
>
>
>
>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
RE: search bean and sorting [ In reply to ]
hi carlson,
I am actually running into problem When I am trying to compile the
HitsIterator class, you have earlier mentioned at
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-dev@jakarta.apach
e.org&msgId=340432
to change the id field in Hits class to public from private.
But I do not see any id field in the Hit class, Am I missing something?
Enclosed is the src of Hits class in RC5.
thanks

-----Original Message-----
From: Peter Carlson [mailto:carlson@bookandhammer.com]
Sent: Wednesday, June 19, 2002 9:55 PM
To: Srinivas.Kotamraju@bmsus.com; Lucene Users List
Subject: Re: search bean and sorting


Hi,

I currently use the SearchBean code (although I did refactor much of the
code in the contribution) to sort by date.

Your same code should work if you created a field "formattedDate"

Again, I haven't tested this new refactored code, so let me know if you run
into any problems.

--Peter

On 6/19/02 12:19 PM, "Srinivas.Kotamraju@bmsus.com"
<Srinivas.Kotamraju@bmsus.com> wrote:

> hi carlson,
> i have seen your code contribution in the lucene sand box. I thank you for
> sharing it will all other developers.I am thinking of using it, but I am
> wondering If the sorting mechanism for a field you have implemented would
> also work for Dates? please let me know.
> I have a bunch of html files with metags like <META NAME="ISSUE_DATE"
> CONTENT="3/25/2002">
> and I am parsing the files and adding the dates using the DateField to my
> index..
>
> doc.add(Field.Keyword("date",DateField.dateToString(formattedDate)));
>
> I want the hits returned, to be sorted by date? would a call to ur
> code..like below..give me the results sorted by date?
> thanks in advance.
> srini
> SearchBean sb = new SearchBean(index,formattedDate);
> HitsIterator hi = sb.search("metal");
> while (hi.hasNext())
> { Document doc = hi.next(); }
>
>
>
>
>
>
>


--
To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>
Re: search bean and sorting [ In reply to ]
Sorry about that, I meant the id in the Lucene class Hits.

You are really accessing the id data member from the HitDoc class, but that
class is in Hits.

The code would be

/** Returns the id for the nth document in this set. */
public final float id(int n) throws IOException {
return hitDoc(n).id;
}

Just like getting the score.

--Peter


On 6/20/02 6:40 AM, "Srinivas.Kotamraju@bmsus.com"
<Srinivas.Kotamraju@bmsus.com> wrote:

> hi carlson,
> I am actually running into problem When I am trying to compile the
> HitsIterator class, you have earlier mentioned at
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-dev@jakarta.apach
> e.org&msgId=340432
> to change the id field in Hits class to public from private.
> But I do not see any id field in the Hit class, Am I missing something?
> Enclosed is the src of Hits class in RC5.
> thanks
>
> -----Original Message-----
> From: Peter Carlson [mailto:carlson@bookandhammer.com]
> Sent: Wednesday, June 19, 2002 9:55 PM
> To: Srinivas.Kotamraju@bmsus.com; Lucene Users List
> Subject: Re: search bean and sorting
>
>
> Hi,
>
> I currently use the SearchBean code (although I did refactor much of the
> code in the contribution) to sort by date.
>
> Your same code should work if you created a field "formattedDate"
>
> Again, I haven't tested this new refactored code, so let me know if you run
> into any problems.
>
> --Peter
>
> On 6/19/02 12:19 PM, "Srinivas.Kotamraju@bmsus.com"
> <Srinivas.Kotamraju@bmsus.com> wrote:
>
>> hi carlson,
>> i have seen your code contribution in the lucene sand box. I thank you for
>> sharing it will all other developers.I am thinking of using it, but I am
>> wondering If the sorting mechanism for a field you have implemented would
>> also work for Dates? please let me know.
>> I have a bunch of html files with metags like <META NAME="ISSUE_DATE"
>> CONTENT="3/25/2002">
>> and I am parsing the files and adding the dates using the DateField to my
>> index..
>>
>> doc.add(Field.Keyword("date",DateField.dateToString(formattedDate)));
>>
>> I want the hits returned, to be sorted by date? would a call to ur
>> code..like below..give me the results sorted by date?
>> thanks in advance.
>> srini
>> SearchBean sb = new SearchBean(index,formattedDate);
>> HitsIterator hi = sb.search("metal");
>> while (hi.hasNext())
>> { Document doc = hi.next(); }
>>
>>
>>
>>
>>
>>
>>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: search bean and sorting [ In reply to ]
I just committed this change to the Lucene source.

So if you get the current source and build it, you will have this change. Or
you can wait until tonight when it's gets built and put into a jar and get
the nightly build.

--Peter

On 6/20/02 6:40 AM, "Srinivas.Kotamraju@bmsus.com"
<Srinivas.Kotamraju@bmsus.com> wrote:

> hi carlson,
> I am actually running into problem When I am trying to compile the
> HitsIterator class, you have earlier mentioned at
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-dev@jakarta.apach
> e.org&msgId=340432
> to change the id field in Hits class to public from private.
> But I do not see any id field in the Hit class, Am I missing something?
> Enclosed is the src of Hits class in RC5.
> thanks
>
> -----Original Message-----
> From: Peter Carlson [mailto:carlson@bookandhammer.com]
> Sent: Wednesday, June 19, 2002 9:55 PM
> To: Srinivas.Kotamraju@bmsus.com; Lucene Users List
> Subject: Re: search bean and sorting
>
>
> Hi,
>
> I currently use the SearchBean code (although I did refactor much of the
> code in the contribution) to sort by date.
>
> Your same code should work if you created a field "formattedDate"
>
> Again, I haven't tested this new refactored code, so let me know if you run
> into any problems.
>
> --Peter
>
> On 6/19/02 12:19 PM, "Srinivas.Kotamraju@bmsus.com"
> <Srinivas.Kotamraju@bmsus.com> wrote:
>
>> hi carlson,
>> i have seen your code contribution in the lucene sand box. I thank you for
>> sharing it will all other developers.I am thinking of using it, but I am
>> wondering If the sorting mechanism for a field you have implemented would
>> also work for Dates? please let me know.
>> I have a bunch of html files with metags like <META NAME="ISSUE_DATE"
>> CONTENT="3/25/2002">
>> and I am parsing the files and adding the dates using the DateField to my
>> index..
>>
>> doc.add(Field.Keyword("date",DateField.dateToString(formattedDate)));
>>
>> I want the hits returned, to be sorted by date? would a call to ur
>> code..like below..give me the results sorted by date?
>> thanks in advance.
>> srini
>> SearchBean sb = new SearchBean(index,formattedDate);
>> HitsIterator hi = sb.search("metal");
>> while (hi.hasNext())
>> { Document doc = hi.next(); }
>>
>>
>>
>>
>>
>>
>>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>