Mailing List Archive

Re: search bean and sorting
Hi Srinivas,

I have just tried your code and I think I found the problem.

You didn't create the global array that is required. If you uncomment the
line

SortedField.addField("mydate",indexStore);

This will create a sort order based on the date.

Then if you run your tests it will work. I just tried it and it works for
me.

This generic mechanism should allow you to sort by as many fields as you
want.

I hope this helps.

--Peter

On 6/23/02 2:49 PM, "Kotamraju, Srinivas, BmS- NY1540"
<Srinivas.Kotamraju@bmsus.com> wrote:

>
> hi peter,
> I sent an email earlier with questions about the search bean, and thanks for
> the feedback. I am still not able to sort the dates.Enclosed is the test
> code..I have 2 documents with different dates.In the hitlist, I would not
> get them in the right order..I get the record of 04/22/02 first before the
> record of 06/20/2002. As you see, I am calling HitsIterator hi = new
> HitsIterator(hits,"mydate"); before displaying the results, any ideas to get
> it the right way?
> thanx in advance.
> srini
>
> -----Original Message-----
> From: Peter Carlson
> To: Srinivas.Kotamraju@bmsus.com
> Sent: 6/20/02 10:19 AM
> Subject: Re: search bean and sorting
>
> Lucene abstracts where the data lives, it lives in a directory.
> Currently it supports either RamDirectory or FSDirectory (for file
> system directory)
>
>
> To create a directory use the static method
> FSDirectory.getDirectory(path, create).
>
> The link to the JavaDoc is
> http://jakarta.apache.org/lucene/docs/api/org/apache/lucene/store/FSDire
> ctory.html
>
> It seems like there should be a constructor for this.
>
> --Peter
>
>
>
> On 6/20/02 8:07 AM, "Srinivas.Kotamraju@bmsus.com"
> <Srinivas.Kotamraju@bmsus.com> wrote:
>
>> hi carlson,
>> I am able to compile the files now.But would I use the searchBean
>> Constructor to point to the location of my index files?I see that it
> takes a
>> Directory object..but say, I have my searchindex stored at
>> /usr/local/tomcat/search_index/*.*..
>> If I use indexSearcher, I could do something like..
>> // Searcher searcher = new IndexSearcher(indexPath);
>> how would I change this with SearchBean..
>> thanx in advance.
>> srini
>
>
>


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