Still can not implement this feature. Previously to perform a search in the
'label', I used the following code that worked:
Query q = new QueryParser(Version.LUCENE_43, "label", analyzer
> ).parse(label);
> searcher.search(q, collector);
> ScoreDoc[] hits = collector.topDocs().scoreDocs;
But with
Your BooleanQuery code looks fine. Do the label and abstract searches
work independently? Are there docs that match both searches? There
are tips on non-working searches in the FAQ at
http://wiki.apache.org/lucene-java/LuceneFAQ#Why_am_I_getting_no_hits_.2F_incorrect_hits.3F
If that doesn't help
I experimented with the previous code, but no results are returned from the
index. Someone can give me an example? I have been for some time trying to
implement this functionality.
Thanks.
2013/8/6 David Miranda
> Do this with the BooleanQuery:
>
>> Query q1 = new QueryParser(Version.LUCENE_43,
Do this with the BooleanQuery:
> Query q1 = new QueryParser(Version.LUCENE_43, "label", analyzer
> ).parse(label);
> Query q2 = new QueryParser(Version.LUCENE_43, "abstract", analyzer
> ).parse(abstract);
> BooleanQuery bq = new BooleanQuery();
> booleanQuery.add(q1,BooleanClause.Occur.MUST);
> bo
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 Fil
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;