On 02/02/2016 03:20 PM, Erik Hatcher wrote:
On Feb 2, 2016, at 8:57 AM, Elodie Sannier <elodie.sann...@kelkoo.fr> wrote:
Hello,
We are using solr 4.10.4 and we want to update to 5.4.1.
With solr 4.10.4:
- we extend PhraseQuery with a custom class in order to remove some
terms from phrase queries with phrase slop (update of add(Term term, int
position) method)
- in order to use our implementation, we extend ExtendedSolrQueryParser
with a custom class and we override the method newPhraseQuery but with
solr 5 this method does not exist anymore
How can we do this with solr 5.4.1 ?
You’ll want to override this method, it looks like:
protected Query getFieldQuery(String field, String queryText, int slop)
Hi Erik,
To change the behavior of the PhraseQuery either:
- we change it after the natural cycle. The PhraseQuery is supposed
to be immutable and the setSlop(int s) is deprecated... we don't really
want to do this.
- we override the code that actually build it :
org.apache.solr.search.ExtendedDismaxQParser.getFieldQuery(String field,
String val, int slop) PROTECTED
use getAliasedQuery() PROTECTED
use getQuery() PRIVATE which use new PhraseQuery.Builder()
to create the query...
so not easy to override the behavior: we would need to
overrride/duplicate getAliasedQuery() and getQuery() methods. we don't
really want to do this either.
So we don't really know where to go.
Thanks,
Gerald (I'm working with Elodie on the subject)
Kelkoo SAS
Société par Actions Simplifiée
Au capital de € 4.168.964,30
Siège social : 158 Ter Rue du Temple 75003 Paris
425 093 069 RCS Paris
Ce message et les pièces jointes sont confidentiels et établis à l'attention
exclusive de leurs destinataires. Si vous n'êtes pas le destinataire de ce
message, merci de le détruire et d'en avertir l'expéditeur.