lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Franck Lefebure <franck.lefeb...@softbridge.fr>
Subject Fwd: filtering query with doc id
Date Wed, 28 Mar 2018 17:24:56 GMT
Hi,
I'm new here and newbie with Lucene, sorry if this first question
looks a little dumb.

In a LeafCollector.collect(doc), I would like to (optionally) perform
a query in cascade

Actually I have something that looks like :

public void collect(int docId) throws IOException {
   if (searchForJoinedDoc) {
        String joinQuery = // query involving GlobalOrdinalsQuery or
ToParentBlockJoinQuery
        String id =
context.reader().document(docId).getField("id").stringValue();
        Query boolQuery = new BooleanQuery.Builder()
            .add(joinQuery, filter)
            .add(new TermQuery(new Term("id", id)), filter).build()
        boolean hasJoinedDoc = new
IndexSearcher(leafReaderContext).search(query, 1).totalHits == 1
   }
}

Is there a better way to write this without the TermQuery ? Can I
exploit directly the docId in a filter ?

Thanks,
Franck

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