You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by io...@group.novartis.com on 2004/09/09 14:47:11 UTC

TermQuery PROBLEM!!!

Hello everybody and esp. Erik:)

In case search entry is empty, I'd like to generate all documents came
during the last minute
I have a filed ( created as doc.add(Field.Keyword(F_PUBLISHORT,
publishort));) containing this data in "yyyyMMddhhMM" format.

The problem is I get nothing, but I do know I have documents with for
example "200404271420" value

WHAT I DO WRONG?

When I do queries based on QueryParser (i.e. filter!=null) everything is
ok.

Thanks in advance
J.


......
           if (filter==null || filter.equals("")){
             filter=null;
             line="200404271420";
             fld = "publishort";
           }
.......


            if (filter==null){
                  query = new TermQuery(new Term(fld,line));
            }else{
                  NeisQueryParser nqp=new NeisQueryParser();
                  query = nqp.parse(line);
            }

            formated_query=query.toString();
            Sort sort=null;
            ms = getMS(); //MultiSearcher
            if (filter==null) {
                  if (sort_byscore)hits = ms.search(query,
getCurrentTimeFilter());
                  else hits = ms.search(query,getCurrentTimeFilter(),
"publishort");
            }else{
                  if (range_flag){
                        if (sort_byscore)hits = ms.search(query,
getDateFilter(),(String)null);
                        else hits = ms.search(query,getDateFilter(),sort);
                  }else{
                        if (sort_byscore)hits = ms.search(query);
                        else hits = ms.search(query,sort);
                  }
            }
            total_hitnum=hits.length();
            String logdata="";



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


Re: TermQuery PROBLEM!!!

Posted by Erik Hatcher <er...@hatcher.net>.
You have way too much confusing code there for me to try to take in, 
but surely the situation is AnalysisParalysis:

	http://wiki.apache.org/jakarta-lucene/AnalysisParalysis

Try to narrow down things to a very simple example for posting allowing 
others to very quickly and clearly see your code - this makes it easier 
for us to do a more thorough job responding.

	Erik


On Sep 9, 2004, at 5:47 AM, iouli.golovatyi@group.novartis.com wrote:

>
> Hello everybody and esp. Erik:)
>
> In case search entry is empty, I'd like to generate all documents came
> during the last minute
> I have a filed ( created as doc.add(Field.Keyword(F_PUBLISHORT,
> publishort));) containing this data in "yyyyMMddhhMM" format.
>
> The problem is I get nothing, but I do know I have documents with for
> example "200404271420" value
>
> WHAT I DO WRONG?
>
> When I do queries based on QueryParser (i.e. filter!=null) everything 
> is
> ok.
>
> Thanks in advance
> J.
>
>
> ......
>            if (filter==null || filter.equals("")){
>              filter=null;
>              line="200404271420";
>              fld = "publishort";
>            }
> .......
>
>
>             if (filter==null){
>                   query = new TermQuery(new Term(fld,line));
>             }else{
>                   NeisQueryParser nqp=new NeisQueryParser();
>                   query = nqp.parse(line);
>             }
>
>             formated_query=query.toString();
>             Sort sort=null;
>             ms = getMS(); //MultiSearcher
>             if (filter==null) {
>                   if (sort_byscore)hits = ms.search(query,
> getCurrentTimeFilter());
>                   else hits = ms.search(query,getCurrentTimeFilter(),
> "publishort");
>             }else{
>                   if (range_flag){
>                         if (sort_byscore)hits = ms.search(query,
> getDateFilter(),(String)null);
>                         else hits = 
> ms.search(query,getDateFilter(),sort);
>                   }else{
>                         if (sort_byscore)hits = ms.search(query);
>                         else hits = ms.search(query,sort);
>                   }
>             }
>             total_hitnum=hits.length();
>             String logdata="";
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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