Re: Hits sorted

2005-10-13 Thread Daniel Cortes

thks but It doesn't work, I tried this
   Hits encontrados=searcher.search(buscar,new Sort(DATE));

and all my documents have a Field.Keyword called DATE.
If i do the search without sort parameter it returns me a lot of 
results, but if i do the search with sort parameter it doesn't return 
any hits.why?
I thinked that the only thing that I need to use Sort is that the field 
was indexed and not tokenized and in my case is a Field type Keyword.



Mordo, Aviran (EXP N-NANNATEK) wrote:


Just use the Sort option in the searcher
http://lucene.apache.org/java/docs/api/org/apache/lucene/search/Searcher
.html#search(org.apache.lucene.search.Query,%20org.apache.lucene.search.
Sort)

Aviran
http://www.aviransplace.com

-Original Message-
From: Daniel Cortes [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 11, 2005 2:58 PM

To: java-user@lucene.apache.org
Subject: Hits sorted

Hi everybody, I have a problem when I find all the documents added in
the last days in my index. It works good but I want show this results
sorted. What I have to do?

My code is this:

   private RangeQuery findINTODates(int days) {
   Term from;
   Term to;

   Calendar calendar = new GregorianCalendar();
   calendar.add(Calendar.DATE,-(days));
  
   SimpleDateFormat originalFormatter = new SimpleDateFormat

(MMdd);
   from = new
Term(DATE,originalFormatter.format(calendar.getTime()));
   to = new Term(DATE,originalFormatter.format(new Date()));

   RangeQuery lastdays= new RangeQuery(from,to,true);

   return lasdays;
   }

and I call this

   Hits returned=searcher.search(findINTODates(num_days));

What I have to do? I have to use DateFilter or Sort elements ?  I don't
know how to work with these classes.
In mMy documents of lucene I added the field Date how a string and not
how a date because it's more easy for add documents to index in my case.

thks for all.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hits sorted

2005-10-13 Thread Daniel Cortes

Excuse me I don't write the trace of error
java.lang.RuntimeException: no terms in field DATE - cannot determine 
sort type
   at 
org.apache.lucene.search.FieldCacheImpl.getAuto(FieldCacheImpl.java:319)
   at 
org.apache.lucene.search.FieldSortedHitQueue.comparatorAuto(FieldSortedHitQueue.java:327)
   at 
org.apache.lucene.search.FieldSortedHitQueue.getCachedComparator(FieldSortedHitQueue.java:170)
   at 
org.apache.lucene.search.FieldSortedHitQueue.init(FieldSortedHitQueue.java:58)
   at 
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:122)
   at 
org.apache.lucene.search.MultiSearcher.search(MultiSearcher.java:141)

   at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64)
   at org.apache.lucene.search.Hits.init(Hits.java:51)
   at org.apache.lucene.search.Searcher.search(Searcher.java:41)

thks in advance.


Daniel Cortes wrote:


thks but It doesn't work, I tried this
   Hits encontrados=searcher.search(buscar,new Sort(DATE));

and all my documents have a Field.Keyword called DATE.
If i do the search without sort parameter it returns me a lot of 
results, but if i do the search with sort parameter it doesn't return 
any hits.why?
I thinked that the only thing that I need to use Sort is that the 
field was indexed and not tokenized and in my case is a Field type 
Keyword.



Mordo, Aviran (EXP N-NANNATEK) wrote:


Just use the Sort option in the searcher
http://lucene.apache.org/java/docs/api/org/apache/lucene/search/Searcher
.html#search(org.apache.lucene.search.Query,%20org.apache.lucene.search.
Sort)

Aviran
http://www.aviransplace.com

-Original Message-
From: Daniel Cortes [mailto:[EMAIL PROTECTED] Sent: Tuesday, 
October 11, 2005 2:58 PM

To: java-user@lucene.apache.org
Subject: Hits sorted

Hi everybody, I have a problem when I find all the documents added in
the last days in my index. It works good but I want show this results
sorted. What I have to do?

My code is this:

   private RangeQuery findINTODates(int days) {
   Term from;
   Term to;

   Calendar calendar = new GregorianCalendar();
   calendar.add(Calendar.DATE,-(days));
 SimpleDateFormat originalFormatter = new SimpleDateFormat
(MMdd);
   from = new
Term(DATE,originalFormatter.format(calendar.getTime()));
   to = new Term(DATE,originalFormatter.format(new Date()));

   RangeQuery lastdays= new RangeQuery(from,to,true);

   return lasdays;
   }

and I call this

   Hits returned=searcher.search(findINTODates(num_days));

What I have to do? I have to use DateFilter or Sort elements ?  I don't
know how to work with these classes.
In mMy documents of lucene I added the field Date how a string and not
how a date because it's more easy for add documents to index in my case.

thks for all.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hits sorted

2005-10-13 Thread Miles Barr
On Thu, 2005-10-13 at 11:58 +0200, Daniel Cortes wrote:
 Solved, only replace
 new Sort(new SortField(DATE,SortField.INT, true)));

Alternatively you could use the DateField class:

http://lucene.apache.org/java/docs/api/org/apache/lucene/document/DateField.html

to translate your date's into Lucene's date representation. Of course
you'd have to update your index to store the date in the same format.



Miles Barr



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unexpected analyzer behaviour with special characters

2005-10-13 Thread Xavier Orri
Hi,

I don't understand why my third test fails. If I scape my - delimiter
 what I expect is a character behaviour.

Could you clarify me what I'm doing wrong?


public void testStandardAnalyzer() throws Exception {
Analyzer a = new StandardAnalyzer();
assertAnalyzesTo(a, ses1-one3, new String[]{ses1-one3});
assertAnalyzesTo(a, session-one, new String[]{session,one});
assertAnalyzesTo(a, session\\-one, new String[]{session\\-one});
}

Thanking in advance
Xavier Orri


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unexpected analyzer behaviour with special characters

2005-10-13 Thread Erik Hatcher
StandardAnalyzer does not have any escaped-character handling  
capability.  So the backslash and dash are treated without any  
special care in session\-one.


You will need to build your own Analyzer with a custom tokenizer to  
handle this type of escaping.


Erik

On Oct 13, 2005, at 8:29 AM, Xavier Orri wrote:


Hi,

I don't understand why my third test fails. If I scape my -  
delimiter

 what I expect is a character behaviour.

Could you clarify me what I'm doing wrong?


public void testStandardAnalyzer() throws Exception {
Analyzer a = new StandardAnalyzer();
assertAnalyzesTo(a, ses1-one3, new String[]{ses1-one3});
assertAnalyzesTo(a, session-one, new String[]{session,one});
assertAnalyzesTo(a, session\\-one, new String[]{session\\- 
one});

}

Thanking in advance
Xavier Orri


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RemoteSearchable woes

2005-10-13 Thread Peter Kim
The system I'm working on requires that I also need to use a custom hit
collector. I'm not using the RemoteSearchable. Instead, I'm just binding
an object called SearcherImpl that contains an IndexSearcher and a
getResults() method that uses the custom hit collector. 

Peter

 -Original Message-
 From: Jeff Rodenburg [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 11, 2005 11:15 PM
 To: java-user@lucene.apache.org
 Subject: RemoteSearchable woes
 
 Anyone running RemoteSearchable? I'm on v1.4.3 and am using 
 it just fine, until I need to:
 
 1) use a custom sort, or
 2) use something that extends HitCollector
 
 I've got an idea as to the reasons why (serialization and 
 remoteness), but how do I get around these? Anyone run into 
 issues like these and found a crafty way to solve it?
 
 Thoughts, comments, suggestions?
 
 - jeff r.
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: docMap array in SegmentMergeInfo

2005-10-13 Thread Peter Keegan
Hi Yonik,

Your patch has corrected the thread thrashing problem on multi-cpu systems.
I've tested it with both 1.4.3 and 1.9. I haven't seen 100X performance
gain, but that's because I'm caching QueryFilters and Lucene is caching the
sort fields.

Thanks for the fast response!

btw, I had previously tried Chris's fix (replace synchronized method with
snapshot reference), but I was getting errors trying to fetch stored fields
from the Hits. I didn't chase it down, but the errors went away when I
reverted that specific patch.

Peter


On 10/12/05, Yonik Seeley [EMAIL PROTECTED] wrote:

 Here's the patch:
 http://issues.apache.org/jira/browse/LUCENE-454

 It resulted in quite a performance boost indeed!

 On 10/12/05, Yonik Seeley [EMAIL PROTECTED] wrote:
 
  Thanks for the trace Peter, and great catch!
  It certainly does look like avoiding the construction of the docMap for
 a
  MultiTermEnum will be a significant optimization.
 
 
 -Yonik
 Now hiring -- http://tinyurl.com/7m67g




Re: Do you believe in Clause sanity?

2005-10-13 Thread Andy Lee
Oops, I'm confusing libraries.  I meant I want to remove a Nutch  
Clause from a Nutch Query.


--Andy

On Oct 13, 2005, at 4:45 PM, Andy Lee wrote:

The API for BooleanQuery only seems to allow adding clauses.  The  
nearest way I can see to *remove* a clause is by laboriously  
constructing a new BooleanQuery (assuming you aren't absolutely  
tied to the original instance) and adding all the clauses from the  
original query except the one you're removing.  And *that's* rather  
cumbersome because you can't actually add a clause; you have to use  
one of the addRequired-/addProhibited- methods -- and they take  
arrays of String rather than the array of Term that you can get  
from a Clause.


It seems reasonable to me to want to remove clauses from a query.   
Is there some reasonable way of doing this that I'm missing?


--Andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]