lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nukie <stas.band...@gmail.com>
Subject Re: Using Hits as document space for new search
Date Wed, 17 Sep 2008 09:41:19 GMT

Of course.

In my search functionality i need ability after main search, to define more
exactly what to search by adding more search parameters, and get information
about search results count after adding each of new parameter. 

For example,  in my case it's car  searching form.
First of all i'm telling that i want to search for BMW. System returning set
of results. 
In process of viewing results system shows additional criterias for making
search result more exact, and shows count of result set after adding this
criteria (..this count is smaller than current result set size, because new
result is just subset of current result list).

So i have to make independent query for getting result set size got with
each new query.

      TermQuery audiTerm = new TermQuery(new Term("Make", "AUDI"));
      ChainedFilter cf = new ChainedFilter(new Filter [] {new
RangeFilter("Milleage", NumberTools.longToString(5000),
NumberTools.longToString(5100), true, true)}, new int []
{ChainedFilter.AND});
      BooleanQuery someAudi = new BooleanQuery();
      
      someAudi.add(audiTerm, BooleanClause.Occur.SHOULD);
      Hits hits;      
      long time = System.currentTimeMillis();
      hits = searcher.search(someAudi, cf, new Sort("Milleage"));

      long newTime = System.currentTimeMillis();
      System.out.println("Search time : " + String.valueOf(newTime - time) +
" RESULT SIZE : " + String.valueOf(hits.length()));
      time = System.currentTimeMillis();
      hits = searcher.search(someAudi, cf, new Sort("Milleage"));
      newTime = System.currentTimeMillis();
      System.out.println("Search time : " + String.valueOf(newTime - time) +
" RESULT SIZE : " + String.valueOf(hits.length()));
    
This is simple example of building general query. After making search more
complicated more terms could be added to BooleanQuery , etc.

I thought that i could to filter currently avaible hits. 


Erick Erickson wrote:
> 
> I'm confused about what your "variants of search criterias" are. Could
> you provide a few examples?
> 
> Also, if you can provide a higher-level statement of your problem, folks
> can often come up with alternate approaches.
> 
> Best
> Erick
> 
-- 
View this message in context: http://www.nabble.com/Using-Hits-as-document-space-for-new-search-tp19511672p19527798.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Mime
View raw message