lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <jpou...@gmail.com>
Subject Re: Lucene 4.x -> 5.x: Converting FieldValueFilter to FieldValueQuery
Date Sun, 01 Nov 2015 22:27:20 GMT
Hi Andreas,

FieldValueQuery is indeed the replacement. I you don't plan on adding other
clauses to the boolean query, you can even run the FieldValueQuery directly
through IndexSearcher, without wrapping it in a BooleanQuery.

The fact that you need to index doc values is related to another change in
which we removed Lucene's FieldCache and now recommend to use doc values
instead. Until you reindex with doc values, you can temporarily use
UninvertingReader[1] to have the same behaviour as in Lucene 4.x.

[1]
http://lucene.apache.org/core/5_0_0/misc/index.html?org/apache/lucene/uninverting/UninvertingReader.html



Le mer. 14 oct. 2015 à 12:06, Andreas Sewe <andreas.sewe@codetrails.com> a
écrit :

> Hi,
>
> I am currently in the process of moving from Lucene 4.x to 5.x. As far
> as I understand things, a filter like
>
>   filter = new FieldValueFilter("name", false);
>
> translates to
>
>   BooleanQuery filter = new BooleanQuery();
>   filter.add(new FieldValueQuery("name"), Occur.FILTER);
>
> with the additional caveat that the field "name" now also needs to be
> indexed as SortedDocValuesField, as otherwise the FieldValueQuery won't
> work. Am I correct? What are the implications of this change, both in
> term of search performance and index size (as I am adding more "fields")?
>
> Best wishes,
>
> Andreas
>
> --
> Codetrails GmbH
> The knowledge transfer company
>
> Robert-Bosch-Str. 7, 64293 Darmstadt
> Phone: +49-6151-276-7092
> Mobile: +49-170-811-3791
> http://www.codetrails.com/
>
> Managing Director: Dr. Marcel Bruch
> Handelsregister: Darmstadt HRB 91940
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message