lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Searching within a Search Result
Date Tue, 06 Aug 2013 15:21:46 GMT
The standard way is to combine the searches by label and abstract into
one query.  If using QueryParser a simple example would look something
like label:aaa abstract:bbb abstract:ccc.  You can get the same
effect, with more flexibility, by building a BooleanQuery in code.

Also consider using a Filter e.g. QueryWrapperFilter on a query for
label:aaa with the query generated by QueryParser or direct
construction of a TermQuery.  See also CachingWrapperFilter if the
index isn't constantly changing.


--
Ian.


On Tue, Aug 6, 2013 at 3:19 PM, David Miranda <david.b.miranda@gmail.com> wrote:
> Hi,
>
> I have a Lucene index that has the fields label and abstract.
>
> I want to do is first do a search by label field, for this i use:
>
> TopScoreDocCollector collector = TopScoreDocCollector.create(MAX_HITS, true
>> );
>> searcher.search(q, collector);
>> ScoreDoc[] hits = collector.topDocs().scoreDocs;
>
>
> After the results of the first survey, I want to do a search in the
> abstract field only in results obtained from the first survey.
>
> How i do this?
> Thanks in advance.
>
> David

---------------------------------------------------------------------
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