lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From testn <te...@doramail.com>
Subject Re: Implement a filter to the search results
Date Tue, 11 Sep 2007 01:33:26 GMT

It's probably easier to add category, department, year as a part of query and
then requery to get the hits you need. 

M.K wrote:
> 
> Hi All,
> 
> I have a search form which has an input area for key search and also 
> three
> optional select boxs  *Catagory, Department and Year. *
>  My question is how can I filter the results if users select a category or
>  a department or a year or a combination of them.
> 
> *index *:
> 
> IndexWriter indexWriter =
> *new* IndexWriter(API.*getRootPath*() + "\\data\\LUCENE" ,
> *new*StandardAnalyzer(),true);
> 
> Document document = *new* Document();
> 
> document.add(Field.*Text*("text", docText));
> 
> document.add(Field.*UnIndexed*("department", depart));
> 
> document.add(Field.*UnIndexed*(
> "category", courseId));
> 
> document.add(Field.*UnIndexed*(
> "year", year));
> 
> indexWriter.addDocument(document);
> 
> indexWriter.close();
> 
> 
> 
> *search: *
> 
> *Searcher searcher = new IndexSearcher(API.getRootPath() +
> "/data/LUCENE/");
> Analyzer analyzer = new StandardAnalyzer();*
> 
> * Query query = QueryParser.parse(request.getParameter("query"), "text",
> analyzer);
>  Hits hits = searcher.search (query);*
> 
> I do not konw how implement a filter to the results of the search for
> catgory or year or department.
> 
> Thanks,
> 
> Massoud
> 
> 

-- 
View this message in context: http://www.nabble.com/Implement-a-filter-to-the-search-results-tf4418068.html#a12606295
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