[jira] [Commented] (SOLR-2883) Add QParser boolean hint for filter queries
[ https://issues.apache.org/jira/browse/SOLR-2883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15516813#comment-15516813 ] David Smiley commented on SOLR-2883: Terms' {{method}} doesn't change the semantic effects; it's only about efficiency given different options. This may be an old issue number but nonetheless I feel it's valid still. > Add QParser boolean hint for filter queries > --- > > Key: SOLR-2883 > URL: https://issues.apache.org/jira/browse/SOLR-2883 > Project: Solr > Issue Type: Improvement > Components: search >Reporter: David Smiley > > It would be useful if there was a QParser hint of some kind that indicated > that the score isn't needed. This would be set by Solr in QueryComponent when > processing the fq param, and some field types could check for this and return > more efficient Query implementations from FieldType.getFieldQuery(). For > example, a geospatial field could return a ConstantScoreQuery(Filter) > implementation when only filtering is needed, or return a query that returns > a geospatial distance for a document's score. I think there are probably > other opportunities for this flag to have its use but I'm not sure. > As an example solution, a local param of needScore=false could be added. I > should be functionally equivalent to fq={!needScore=false}. > Here is a modified portion of QueryComponent at line 135 to illustrate what > the change would be. I haven't tested it but it compiles. > {code:java} > for (String fq : fqs) { > if (fq != null && fq.trim().length()!=0) { > QParser fqp = QParser.getParser(fq, null, req); > SolrParams localParams = fqp.getLocalParams(); > SolrParams defaultLocalParams = new > MapSolrParams(Collections.singletonMap("needScore","false")); > SolrParams newLocalParams = new > DefaultSolrParams(localParams,defaultLocalParams); > fqp.setLocalParams(newLocalParams); > filters.add(fqp.getQuery()); > } > } > {code} > It would probably be best to define the "needScore" constant somewhere better > but this is it in a nutshell. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (SOLR-2883) Add QParser boolean hint for filter queries
[ https://issues.apache.org/jira/browse/SOLR-2883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15516808#comment-15516808 ] Mikhail Khludnev commented on SOLR-2883: This number is a little bit ancient. We already have {{filter(..)}} and {{foo:bar^=1}}. But {{{!terms}}} is a little bit different question. It has dedicated {{method}} switch which judges whether it will rewrite to score or constant score filter. > Add QParser boolean hint for filter queries > --- > > Key: SOLR-2883 > URL: https://issues.apache.org/jira/browse/SOLR-2883 > Project: Solr > Issue Type: Improvement > Components: search >Reporter: David Smiley > > It would be useful if there was a QParser hint of some kind that indicated > that the score isn't needed. This would be set by Solr in QueryComponent when > processing the fq param, and some field types could check for this and return > more efficient Query implementations from FieldType.getFieldQuery(). For > example, a geospatial field could return a ConstantScoreQuery(Filter) > implementation when only filtering is needed, or return a query that returns > a geospatial distance for a document's score. I think there are probably > other opportunities for this flag to have its use but I'm not sure. > As an example solution, a local param of needScore=false could be added. I > should be functionally equivalent to fq={!needScore=false}. > Here is a modified portion of QueryComponent at line 135 to illustrate what > the change would be. I haven't tested it but it compiles. > {code:java} > for (String fq : fqs) { > if (fq != null && fq.trim().length()!=0) { > QParser fqp = QParser.getParser(fq, null, req); > SolrParams localParams = fqp.getLocalParams(); > SolrParams defaultLocalParams = new > MapSolrParams(Collections.singletonMap("needScore","false")); > SolrParams newLocalParams = new > DefaultSolrParams(localParams,defaultLocalParams); > fqp.setLocalParams(newLocalParams); > filters.add(fqp.getQuery()); > } > } > {code} > It would probably be best to define the "needScore" constant somewhere better > but this is it in a nutshell. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (SOLR-2883) Add QParser boolean hint for filter queries
[ https://issues.apache.org/jira/browse/SOLR-2883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15516375#comment-15516375 ] Otis Gospodnetic commented on SOLR-2883: We hit this in Solr-Redis: https://github.com/sematext/solr-redis/issues/38#issuecomment-249184074 > Add QParser boolean hint for filter queries > --- > > Key: SOLR-2883 > URL: https://issues.apache.org/jira/browse/SOLR-2883 > Project: Solr > Issue Type: Improvement > Components: search >Reporter: David Smiley > > It would be useful if there was a QParser hint of some kind that indicated > that the score isn't needed. This would be set by Solr in QueryComponent when > processing the fq param, and some field types could check for this and return > more efficient Query implementations from FieldType.getFieldQuery(). For > example, a geospatial field could return a ConstantScoreQuery(Filter) > implementation when only filtering is needed, or return a query that returns > a geospatial distance for a document's score. I think there are probably > other opportunities for this flag to have its use but I'm not sure. > As an example solution, a local param of needScore=false could be added. I > should be functionally equivalent to fq={!needScore=false}. > Here is a modified portion of QueryComponent at line 135 to illustrate what > the change would be. I haven't tested it but it compiles. > {code:java} > for (String fq : fqs) { > if (fq != null && fq.trim().length()!=0) { > QParser fqp = QParser.getParser(fq, null, req); > SolrParams localParams = fqp.getLocalParams(); > SolrParams defaultLocalParams = new > MapSolrParams(Collections.singletonMap("needScore","false")); > SolrParams newLocalParams = new > DefaultSolrParams(localParams,defaultLocalParams); > fqp.setLocalParams(newLocalParams); > filters.add(fqp.getQuery()); > } > } > {code} > It would probably be best to define the "needScore" constant somewhere better > but this is it in a nutshell. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org